|
Data Structures and Algorithms
with Object-Oriented Design Patterns in C# |
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
.
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.