Data Structures and Algorithms
with Object-Oriented Design Patterns in C# |
The implementation the NaryTree class is very similar to that of the GeneralTree class. The NaryTree class definition also comprises three fields--key, degree, and subtree. The first, key, represents the root node of the tree. The second, an integer degree, records the degree of the root node of the tree. The third, subtree, is an array of NaryTrees. This array contains the subtrees of the given tree.