Question: Complete the pseudocode for the put function in Algorithm 9. given below. The auxiliary method makeChild(p, c, leftChild?) properly modifies the data structure so as

 Complete the pseudocode for the put function in Algorithm 9. given

Complete the pseudocode for the put function in Algorithm 9. given below. The auxiliary method makeChild(p, c, leftChild?) properly modifies the data structure so as to make node c the left child of node p if the leftChild? predicate is true; otherwise, it makes c the right child of p. The auxiliary function findNode(w, k) outputs the last internal (i.e., not NULL) node visited while searching for key k in the subtree rooted at node w; or NULL if that subtree is empty (i.e., w = NULL). Statement 1 [Choose ] Algorithm 9 PUT(T, k, v) 1: 2: if p # NULL and p.key = k then 3: 4: return p 5: 6: if p = NULL then 7: 8: else Statement 3 [Choose ] makeChild(p.w.k

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!