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

![have three pointers left[x], right[x], parent[x], and key[x]. 1. Program the following](https://dsd5zvtm8ll6.cloudfront.net/si.experts.images/questions/2024/09/66f3aad7c95f2_01566f3aad767ecb.jpg)
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
Get step-by-step solutions from verified subject matter experts
