Re: [Python-Dev] On time complexity of heapq.heapify

2016-12-12 Thread Raymond Hettinger
> On Dec 12, 2016, at 8:12 AM, Raymond Hettinger > wrote: > > The heapify() algorithm is well known and well studied. A quick Google > search turns up plenty of explanations: > https://www.google.com/webhp?sourceid=chrome-instant&ion=1&espv=2&ie=UTF-8#q=complexity%20of%20heapify > > > al

Re: [Python-Dev] On time complexity of heapq.heapify

2016-12-12 Thread Raymond Hettinger
> On Dec 11, 2016, at 1:38 PM, Rafael Almeida wrote: > > From what I gather, _siftup(heap, pos) does not run in constant time, but > rather it runs in time proportional to the height of the subtree with root in > ``pos''. Although, according to the in-code comments, it should be faster > than