how to use "heapq" module as a max-heap?

apollo supermonkey at mail.nankai.edu.cn
Sun Mar 29 04:48:53 EDT 2009


if the 'heapq' module supports user-defined comparasion, this problem will 
be much easier.


"Apollo" <tjuhzj at qq.com> 
??????:mailman.2867.1238312539.11746.python-list at python.org...

as we all known, in the standard module 'heapq',  we can easily get the 
smallest item from the heap. i.e. it's an implementation of min-heap.

my question is how to use 'heapq' to extract the biggest item from the heap? 
is it possible?

thanks  in advance.:) 





More information about the Python-list mailing list