Question: a ) ( 3 marks ) Successively insert the values 5 0 , 8 0 , 3 0 , 6 0 , 7 0 and

a)(3 marks) Successively insert the values 50,80,30,60,70 and 40 into an initially emply binary search tree. Show the resultant tree after each insertion.b)(3 marks) Delete 50 from the final tree in part a) and show the two possible resultant trees.c)(3 marks) The method to insert an item into a binary search tree is given below. Complete the code where indicated (...) to permit duplicate insertions of an item.private Node Add(I item, Node node)if (node == null)return new Node (item) ;elseif (item. CompareTo (node.Item)0){node. Left = Add (item, node.Left) ;return node;}elseif (item. CompareTo (node.Item)>0){node.Right = Add (item, node.Right) ;return node;}else}d)(2 marks) Using your algorithm in part c), successively insert the values 50,40,60,50 and 50 into an initially empty binary search tree. Show the resultant tree after each insertion.

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 Programming Questions!