Answered step by step
Verified Expert Solution
Link Copied!

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,

image text in transcribeddo 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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Put Your Data To Work 52 Tips And Techniques For Effectively Managing Your Database

Authors: Wes Trochlil

1st Edition

0880343079, 978-0880343077

More Books

Students also viewed these Databases questions

Question

What are Decision Trees?

Answered: 1 week ago

Question

What is meant by the Term Glass Ceiling?

Answered: 1 week ago