ment the TNode and Tree classes. The TNode class will include a data item name of type string, which will represent a person’s name. Yes, you got it right, we are going to implement a family tree! Please note that this is not a Binary Tree. Write the met
C++ DATA STRUCTURES
Implement the TNode and Tree classes. The TNode class will include a data item name of type string,
which will represent a person’s name. Yes, you got it right, we are going to implement a family tree!
Please note that this is not a Binary Tree.
Write the methods for inserting nodes into the tree,
searching for a node in the tree, and performing pre-order and post-order traversals.
The insert method should take two strings as input. The second string will be added as a child node to
the parent node represented by the first string.
Hint:
The TNode class will need to have two TNode pointers in addition to the name data member:
TNode *sibling will point to the next sibling of this node, and TNode *child will represent the first child of
this node. You see two linked lists here??? Yes! You’ll need to use the linked lists
Step by step
Solved in 4 steps with 3 images