Question: IN C++ write code to: Here is what it should look like: AVL Tree Implementation program Important note: You must separate your program into three

IN C++ write code to: IN C++ write code to: Here is what it should look

Here is what it should look like:

like: AVL Tree Implementation program Important note: You must separate your programinto three files: header file (*.h), implementation file (*.cpp) and main file(*.cpp). Write a program to build an AVL tree by accepting theintegers input from users. For each input, balance the tree and display

AVL Tree Implementation program Important note: You must separate your program into three files: header file (*.h), implementation file (*.cpp) and main file (*.cpp). Write a program to build an AVL tree by accepting the integers input from users. For each input, balance the tree and display it on the screen; you then calculate the preorder, indorder and postoder traversals as well. There should be a menu to drive the program. It should be similar as follows: AVL Tree Implementation A: Insert an integer to tree and show the balanced tree at each insertion. B: Display the balanced tree and show preorder traversal. C: Display the balanced tree and show inorder traversal. D: Display the balanced tree and show postorder traversal. E: Exit To be sure, your program is correctly working, use the following data to test AVL tree: 15, 18, 10, 7, 57, 6, 13, 12, 9, 65, 19, 16, 23 You should perform more test with different data sets. Sample output of AVL Home Work AVL Tree Implemenation A: Insert an integer to tree and show the balanced tree at each insertion. B: Display the balanced tree and show preorder traversal. C: Display the balanced tree and show inorder traversal. D: Display the balanced tree and show postorder traversal. E: Exit = A Enter integer to be added to tree: 15 Node (15) inserted 15 AVL Tree Implemenation A: Insert an integer to tree and show the balanced tree at each insertion. B: Display the balanced tree and show preorder traversal. C: Display the balanced tree and show inorder traversal. D: Display the balanced tree and show postorder traversal. E: Exit Enter integer to be added to tree: 18 Node (18) inserted 15 AV 18 AVL Tree Implemenation A: Insert an integer to tree and show the balanced tree at each insertion. B: Display the balanced tree and show preorder traversal. C: Display the balanced tree and show inorder traversal. D: Display the balanced tree and show postorder traversal. E: Exit Enter integer to be added to tree: 10 Node (10) inserted 15 V----V 10 18 AVL Tree Implemenation A: Insert an integer to tree and show the balanced tree at each insertion. B: Display the balanced tree and show preorder traversal. C: Display the balanced tree and show inorder traversal. D: Display the balanced tree and show postorder traversal. E: Exit -A Enter integer to be added to tree: 23 Node (23) inserted Tree has been rebalanced V- 10 V------ 7 12 V-A-V A-V 6 9 13 15 --V 19 V-V 18 57 V. V---- 16 23 65 AVL Tree Implemenation A: Insert an integer to tree and show the balanced tree at each insertion. B: Display the balanced tree and show preorder traversal. C: Display the balanced tree and show inorder traversal. D: Display the balanced tree and show postorder traversal. E: Exit 15 10 V------ 7 12 V-AV 13 -V 19 V------- 18 57 V...V 23 65 16 Preorder: { 15, 10, 7, 6, 9, 12, 13, 19, 15, 16, 57, 23, 55 } AVL Tree Implemenation A: Insert an integer to tree and show the balanced tree at each insertion. B: Display the balanced tree and show preorder traversal. C: Display the balanced tree and show inorder traversal. D: Display the balanced tree and show postorder traversal. E: Exit V 10 V------ 7 12 V-A-V 13 15 V 19 V------- 18 57 VA V-V 16 23 65 Inorder: { 6, 7, 9, 10, 12, 13, 15, 16, 18, 19, 23, 57, 65 ) AVL Tree Implemenation A: Insert an integer to tree and show the balanced tree at each insertion. B: Display the balanced tree and show preorder traversal. C: Display the balanced tree and show inorder traversal. D: Display the balanced tree and show postorder traversal. E: Exit D 15 --V 1e 19 V------ V------- 7 12 18 57 V-A-V VE V-V 6 9 13 16 23 65 Postorder: { 6, 9, 7, 13, 12, 18, 16, 18, 23, 65, 57, 19, 15} Another way to display the tree on the screen: - 65 57

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 Databases Questions!