I'm not sure what you expect as an answer, but if you mean the heap as
in the data structure, you can not just arbitrarily move one key where
you want as it will destroy the heap property.
Giampaolo Rodola' wrote:
Hi,
I wanted to know if does exist a safe way to, given a heap, move an
arbitrary element to the first position of the heap.
Something like:
>>> heap = [0,3,6,8,10]
>>> heapq.move_to_first_position(heap, 4)
>>> heap = [10, 0,3,6,8]
--- Giampaolo
http://code.google.com/p/pyftpdlib/
--
http://mail.python.org/mailman/listinfo/python-list
--
http://mail.python.org/mailman/listinfo/python-list