Heap (data Structure) - Implementations

Implementations

  • The C++ Standard Template Library provides the make_heap, push_heap and pop_heap algorithms for heaps (usually implemented as binary heaps), which operate on arbitrary random access iterators. It treats the iterators as a reference to an array, and uses the array-to-heap conversion. Container adaptor priority_queue also exists. However, there is no standard support for the decrease/increase-key operation. See also gheap - STL-like generalized heap implementation in C++ with D-heap and B-heap support.
  • The Java 2 platform (since version 1.5) provides the binary heap implementation with class java.util.PriorityQueue in Java Collections Framework.
  • Python has a heapq module that implements a priority queue using a binary heap.
  • PHP has both maxheap (SplMaxHeap) and minheap (SplMinHeap) as of version 5.3 in the Standard PHP Library.
  • Perl has implementations of binary, binomial, and Fibonacci heaps in the Heap distribution available on CPAN.
  • The Go library contains a heap package with heap algorithms that operate on an arbitrary type that satisfied a given interface.
  • Apple's Core Foundation library contains a CFBinaryHeap structure.

Read more about this topic:  Heap (data Structure)