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

purge Method

The purge method for the BinaryTree class is defined in Program gif. The purpose of the purge method is to make the tree empty. It does this by assigning null to all the fields. Clearly, the running time of the purge method is O(1).

   program16418
Program: BinaryTree class purge method.


next up previous contents index

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