Question: Write in C++ Write six basic functions for the BST: Insert, Delete, Search, Find max, Find min, and Print_BST IN C++ 1. Search(x): Find out

Write in C++
Write six basic functions for the BST: Insert, Delete, Search, Find max, Find min, and Print_BST IN C++ 1. Search(x): Find out the index that stores element x using binary search tree mechanism. Print out all the elements in the search path. 2. Find max(): Find and print maximum value in BST 3. Find min): Find and print minimum value in BST 4. Print BST (): Print out the BST structure in the form of array with index 5. Insert(x): Insert a value element x into BST 6. Delete(x): Delete element x in BST including (If it has no children, If it has only one child or if If it has nonempty left and right subtrees) ALL 3 situations After you finished the all functions, following are the things you need to carry out: 1. Insert(5) 2. Insert(8) 3. Insert(3) 4. Insert(1) 5. Insert(4) 6. Insert(9) 7. Insert(18) 8. Insert(20) 9. Insert(19) 10. Insert(2) 11. Perform Print BSTO) 12. Perform Find max() 13. Perform Find min() 14. Perform Search(3) in the BST 15. Perform Search(18) in the BST 16. Perform Search(19) in the BST 17. Delete(19) in the BST, perform Print BST() 18. Delete(2) in the BST, perform Print BSTC) 19. Delete(8) in the BST, perform Print BST() 20. Delete(3) in the BST, perform Print BST() 21. Delete(5) in the BST, perform Print BSTO Note: Although the input values are provided, your code should be able to handle random input values
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
