narytreeclass.h and
narytreeclass.cpp
provides a basis for manipulating N-ary trees.
The implementations of the PreorderTaverse and the associated
DoPreorderTaverse have been omitted.
Complete the implementation of these two functions.
You can test your implementation with
TestTree.cpp, which should output:
0 1 2 0 1 3 4 2 0 1 3 4 5 6 2 0 1 3 4 5 6 2 7 8 9 And now an external traverse MTH517 students can easily implement this!
TestTree.cpp calls a function
ExternalPreorder, whose implementation has also been omitted.
Implement this function, using a treeiterator to move
around the tree in preorder.
Your output should then be:
0 1 2 0 1 3 4 2 0 1 3 4 5 6 2 0 1 3 4 5 6 2 7 8 9 And now an external traverse 0 1 3 4 5 6 2 7 8 9