Q1: Write a C++ program to implement a Binary Search Tree. Your program must allow the user to perform the following tas
Posted: Thu Jul 14, 2022 2:19 pm
Q1:
Write a C++ program to implement a Binary Search Tree. Yourprogram must allow the user to perform the following tasks:
◦ Accept values from the user to insert into the binary searchtree
▪ The first node entered by the user becomes the root node ◦Allow the user to delete nodes from the binary search tree
◦ Allow the user to search for a node within the binary searchtree:
▪ If the search key is found, it returns all the nodesvisited(path traversed) to reach the search key.
▪ If search key is not found, returns the path traversed tolocate the search key and indicates a failed search.
Q2:
Write a C++ program to sort an list of n numbers innon-decreasing order using the QuickSort algorithm
◦ Allow the user to provide n values to be sorted.
◦ Use a left-most element of the array as the pivot
◦ Display the sorted list.
Write a C++ program to implement a Binary Search Tree. Yourprogram must allow the user to perform the following tasks:
◦ Accept values from the user to insert into the binary searchtree
▪ The first node entered by the user becomes the root node ◦Allow the user to delete nodes from the binary search tree
◦ Allow the user to search for a node within the binary searchtree:
▪ If the search key is found, it returns all the nodesvisited(path traversed) to reach the search key.
▪ If search key is not found, returns the path traversed tolocate the search key and indicates a failed search.
Q2:
Write a C++ program to sort an list of n numbers innon-decreasing order using the QuickSort algorithm
◦ Allow the user to provide n values to be sorted.
◦ Use a left-most element of the array as the pivot
◦ Display the sorted list.