Question: 5. (20 Points) Use the TreeInsert () algorithm to insert the following keys: 9,2, 1, 5, 3, 4, 7, 6, 8, 14, 10,12,11,13,15 (in order)

 5. (20 Points) Use the TreeInsert () algorithm to insert the
following keys: 9,2, 1, 5, 3, 4, 7, 6, 8, 14, 10,12,11,13,15
(in order) into an initially empty BST. a. (10 Points) Draw the

5. (20 Points) Use the TreeInsert () algorithm to insert the following keys: 9,2, 1, 5, 3, 4, 7, 6, 8, 14, 10,12,11,13,15 (in order) into an initially empty BST. a. (10 Points) Draw the resulting BST. b. (10 Points) Use the Delete () algorithm to delete the following keys: 9,5,2 (in order) from the BST you drew in part (a), then draw the resulting tree. TreeMinimum (x) Pre: x1= NIL while x. left t=NIL x=x. eeft return x Transplant (T, u, v) if u.parent wi NIL T. root =v else if u un u,parent. left. i. parent. left = else u.parent. r ight =v if v i= NIL v.parent =u parent Delete (T,z) if z.left = NIL Tr case 1 or case 2.1 (right only) else if z.right= NIL (l case 2.2 (left only) else y= TreeMinimum (z.right) I/ case 3 if y.parent t=z Transplant (T, y,yright) y.right =2.right yright,parent=y Transplant (T,z,y). y. left =z.left y left.parent =y

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!