Design a way to represent a family tree in a text file


Problem

Write 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! 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 that you have already implemented in your labs.

a) Write a method which takes a name (string) as input, finds that name in the tree, and prints names of all the descendants of that person.

b) Design a way to represent a family tree in a text file. Then make an import function in your program that reads data from the file and creates a family tree from that data.

Request for Solution File

Ask an Expert for Answer!!
Computer Engineering: Design a way to represent a family tree in a text file
Reference No:- TGS03277170

Expected delivery within 24 Hours