Question: 2. BST (Binary Search Tree) Node x in a BST must have three pointers left[x], right[x], parent[x], and key[x]. 1. Program the following functions. Do

 2. BST (Binary Search Tree) Node x in a BST musthave three pointers left[x], right[x], parent[x], and key[x]. 1. Program the following

2. BST (Binary Search Tree) Node x in a BST must have three pointers left[x], right[x], parent[x], and key[x]. 1. Program the following functions. Do not attach z if it is already in T a. TREE-INSERT (T, z) b. TREE-SEARC(T, k) c. NEAREST-NEIGHBOR(T, k) d. TREE-DELETE(T, z) e. PRINT-BST(T) Prints the key values of the BST. / The BST structre must be preseved, 2. Using TREE-INSERT(T, z) construct a BST with the keys in AI201 and print the BST. Fill in A[20] by rand()%50. Avoid duplicate values. Execute srand(time(NULL)) first. 3. Execute TREE-SEARCHCT, 15), TREE-SEARCH(T, 8), TREE-SEARCH(T, 18) sequentially and print the keys of the nodes visited 4. Execute NEAREST-NEIGHBOR(T, 17), NEAREST-NEIGHBOR(T, 3)

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!