Question: Write a program that inserts the following numbers 20, 5, 8, 3, 12, 9, 2, 16 into the tree in that order. - Announce the
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. Ref: Page 500
Please make the code look like the console window below, (do not forget the tree in the bottom, only use the necessary numbers not all the x's and replace the x with the numbers)

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 2 3 5 8 9 12 16 20 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 time0.016 s Press any key to continue
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
