most of it coded just need to get it working.
please keep most of the logic the same
Simple Binary Treerepo: https://classroom.github.com/a/IeunEoRk (Links to an external site.) template file: Template_HW39.cpp downloadpoints: 40Write a program to create and manipulate a simple binary tree. The binary tree should simple store integer values. Duplicate values can be ignored. You must use pointers and a struct to store and manipulate each node.
Note: Fill out the code using the attached template. Download it to your repo and rename it for your assignment. I am giving you the structure of functions to use. All you have to do is fill in the missing areas! The book uses objects for this project, but the individual functions and algorithms are mostly the same.
Test your program with the given driver. You are to insert nodes, display the tree a few times, find some nodes, delete some nodes, display the tree, insert some nodes again, and finally display the tree again. I highly recommend not doing everything thing at once! Comment out some of the code and test things out as you code. It is okay to temporally pull a command out entirely, just be sure your final product has the full driver working.When you turn in your code, also answer the following:
- What is the purpose of the function findParentNode? Why is the findNode not sufficient for this assignment?
- Draw out (by hand or using ASCII art) the final version of the binary tree. This is after all insertions and deletions and insertions and such. (Hint: this is a very good thing to have handy while you are writing the program).
The output should look something like this: Binary Tree! Inserted node value of 21 Inserted node value of 38 Duplicate value found for 21. Node not inserted Inserted node value of 64 Inserted node value of 20 Inserted node value of 50 Duplicate value found for 21. Node not inserted Inserted node value of 55 Inserted node value of 63 Duplicate value found for 42. Node not inserted Inserted node value of 28 Inserted node value of 54 Inserted node value of 10 Inserted node value of 12 Inserted node value of 97 Displaying nodes in order: 10 12 20 21 28 38 42 50 54 55 63 64 97 Displaying nodes in PRE order: 42 21 20 10 12 38 28 64 50 55 54 63 97 Displaying nodes in POST order: 12 10 20 28 38 21 54 63 55 50 97 64 42 Node 22 NOT found! Node 20 WAS found! Attempting to delete node 52 Unable to find node 52 for deletion! Attempting to delete node 50 Deleting node 50 child on right side only Attempting to delete node 97 Deleting node 97 with no children Attempting to delete node 21 Deleting node 21 children on both sides Looking at node 38 Displaying nodes in order: 10 12 20 28 38 42 54 55 63 64 Inserted node value of 52 Inserted node value of 21 Inserted node value of 97 Displaying nodes in order: 10 12 20 21 28 38 42 52 54 55 63 64 97 Thank you!
- Assignment status: Already Solved By Our Experts
- (USA, AUS, UK & CA PhD. Writers)
- CLICK HERE TO GET A PROFESSIONAL WRITER TO WORK ON THIS PAPER AND OTHER SIMILAR PAPERS, GET A NON PLAGIARIZED PAPER FROM OUR EXPERTS