Question: Do a program that will read names from a file and put them in a binary tree. Use the TreeNode code using an array for

Do a program that will read names from a file and put them in a binary tree. Use the TreeNode code using an array for a Binary Tree to create another class called TreeMap (use Tree for inheritance). Put in a createMap function in the TreeMap that will take a double pointer for string and two integers of height and width (all called by reference) and dynamically allocate a two-dimensional string array with node data at the proper places. In main print the form of the tree using just the returned map and the returned height and width of that map.
Youll have to have a recursive inorder (use passing of a function to print the node) called fillMap (private in TreeMap). The suggested prototypes are:
void createMap(string ** &map, int &height, int &width);
void fillMap(string **map, int level, int left, int center, int width, int subroot);
Note: the whole idea is for createMap to interface with main and CREATE A MAP FOR MAIN! The createMap will also set the height and width to say how big the returned map is. Then main will print that map. The createMap will have to be the one to call fillMap since there are private pointer indexes used.
Have main also search for a name that is in the binary tree and a name that is not (your choice) it should say it found it and the name or didn't find it (and the name, of course). Print the tree regularly using plain inorder and then print the map via the dynamically generated two-dimensional string array (use setw(10)).
For example the data of: Fred Mertz, Betty Boop, Abner Little, Lucy Bee, Georgie Poo, Zac Smith
Should print out:
Fred Mertz
Betty Boop Abner Little
Lucy Bee Zac Smith Georgie Poo
Try the following data:
Nancy Drew
Greg Greed
Helen Hail
John Symthe
Orville Corn
Mustang Sally
Xena II
I only need main.cpp, TreeMap.cpp, and TreeMap.h files.
My teacher already provided BinaryTreeInterface.h, list.txt, Tree.h, Tree.cpp, TreeNode.cpp, TreeNode.h files

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!