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

IsEmpty Property

The IsEmpty property provides a get accessor that indicates whether a given N-ary tree is the empty tree. The implementation of this method is given in Program gif. In this implementation, the key field is null if the tree is the empty tree. Therefore, IsEmpty method simply tests the key field. Clearly, this is a constant time operation.

   program16250
Program: NaryTree methods.


next up previous contents index

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