Data Structures and Algorithms
with Object-Oriented Design Patterns in C# |
The BinaryHeap class has a rather simple implementation. In particular, it requires only a single field, array, which is declared as an array of ComparableObjects. This array is used to hold the objects which are contained in the binary tree. When there are n items in the heap, those items occupy array positions 1, 2, ..., n.