Logo Data Structures and Algorithms with Object-Oriented Design Patterns in C++
next up previous contents index

IsEmpty Member Function

The purpose of the IsEmpty accessor function is to determine whether a given N-ary tree is the empty tree. The implementation of this function is given in Program gif. In this implementation, the key pointer is zero if the tree is the empty tree. Therefore, IsEmpty returns true if when the key member variable is zero. Clearly this is a constant time, O(1), operation.

   program16941
Program: NaryTree Class Member Function Definitions


next up previous contents index

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