Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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 insertionStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started