Possible Duplicate:
What do I use for a max-heap implementation in Python?
Python has a min heap implemented in the heapq module. However, if one would want a max heap, would one have to build from scratch?
Possible Duplicate:
What do I use for a max-heap implementation in Python?
Python has a min heap implemented in the heapq module. However, if one would want a max heap, would one have to build from scratch?
No need to implement a max heap from scratch. You can easily employ a bit of math to turn your min heap into a max heap!
See this and this - but really this SO answer.