Hi,
this is related to what I'm trying to implement here:
My question is the following: is it safe to avoid to re-heapify() a
heap when I remove or move an element which is not the first one?
Example:
Thanks in advance.
--- Giampaolo
this is related to what I'm trying to implement here:
My question is the following: is it safe to avoid to re-heapify() a
heap when I remove or move an element which is not the first one?
Example:
>>from heapq import *
>>heap = [2,4,6,7,1,2,3]
>>heapify(hea p)
>>del heap[4]
>># Am I forced to heapify() the heap here?
>>heap = [2,4,6,7,1,2,3]
>>heapify(hea p)
>>del heap[4]
>># Am I forced to heapify() the heap here?
--- Giampaolo
Comment