A binary heap is a heap-ordered complete binary tree which is implemented using an array. In a heap the smallest key is found at the root and since the root is always found in the first position of the array, finding the smallest key is a trivial operation in a binary heap.
Program declares the class BinaryHeap.
The BinaryHeap class is derived from
the PriorityQueue abstract base class.
Since BinaryHeap is a concrete class
it provides implementations for all of the member functions
declared as pure virtual functions in the base class.
In the interest of brevity,
the declarations of these functions have been elided
from Program
.
Program: BinaryHeap Class Definition