Question: do in c# if required to code otherwise answer Question 5: Binary Search Trees (11 marks) a) (3 marks) Successively insert the values 50, 80,
do in c# if required to code otherwise answer
Question 5: Binary Search Trees (11 marks) a) (3 marks) Successively insert the values 50, 80, 30, 60, 70 and 40 into an initially empty 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 (T item, Node node) if (nodenull) return new Node (item) else if (item.CompareTo (node. Item) 0) node . Left = Add (item, return node; node . Left); else if (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
Get step-by-step solutions from verified subject matter experts
