Cover Data Structures and Algorithms with Object-Oriented Design Patterns in Java
next up previous contents index

Fields

The BinaryHeap class has a rather simple implementation. In particular, it requires only a single field, array, which is declared as an array of Comparable objects. 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.


next up previous contents index

Bruno Copyright © 1998 by Bruno R. Preiss, P.Eng. All rights reserved.