I just noticed something and I wonder if there is any reason for that. Except for C++ (std::priority_queue is a max heap), I don't know any other language that offers a max heap.
Python's heapq module implements a binary min-heap on top of a list.
Java's library contains a PriorityQueue class, which implements a min-priority-queue.
Go's library contains a container/heap module, which implements a min-heap on top of any compatible data structure.
Apple's Core Foundation framework contains a CFBinaryHeap structure, which implements a min-heap.
I find a max-heap more intuitive than a min-heap and I believe technically the implementation difference is only a question of changing a comparison operator. Is there any real reason? Most of the applications need a min instead of a max heap? Thanks in advance
std::not2(std::less<T>()). – Alexandre C. May 17 '11 at 11:57