Question
Need help with my c++ code, thank you. Using the BinaryTree.h file (shown below), write a program that inserts the following numbers 20, 5, 8,
Need help with my c++ code, thank you.
Using the BinaryTree.h file (shown below), write a program that inserts the following numbers 20, 5, 8, 3, 12, 9, 2, 16 into the tree in that order.
Announce the numbers being inserted
Output the number of nodes, and then display them in order
Delete 8 and 12 from the tree
Output the number of nodes, and then display them in order
Display the tree in postorder
Modify the header as needed to output the values horizontally
Display the tree as it exists and replace the Xs with the correct value in the nodes. Use cout statements and only display branches that exist
The program will have the header file (BinaryTree.h) and your main program. NOTE: Older compilers do not accept nullptr, use NULL to initialize pointers.
Inserting nodes with 20, 5, 8, 3, 12, 9, 2, and 16 The number of nodes in the tree is now 8 Here are the values in the tree in order: 2358912 16 29 Now deleting 8 from the tree... Now deleting 12 from the tree... The number of nodes in the tree is now 6 Here are the values in the tree in order 2 3 5 9 16 20 Here are the values in the tree in POST order: 2 3 9 16 5 20 Tree Process returned 0 (0x0 excution time 0.016 s Press any key to continue
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started