Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Add a method to the binary search tree class that returns false if the value passed into the method is not in the tree. If

image text in transcribed

Add a method to the binary search tree class that returns false if the value passed into the method is not in the tree. If the value is in tree, then return true plus the values on either side of the value. In other words, if the value is in the tree, return true plus set the left reference variable to the closest value in the tree the is less than value and set the right reference variable to the closest value in the tree that is greater than value. The first line of the method is: public bool ReturnEnds(T value, ref I left, ref T right) Example: 15 5 50 1 45 95 where this tree is a variable called aBst aBst.ReturnEnds(15, ref I, refr) returns true and 1=5, r=45 aBst.ReturnEnds(50, ref I, ref r) returns true and I=45, r=95 aBst. ReturnEnds(9, ref I, ref r) returns false aBst.ReturnEnds(5, refl, ref r) returns true and I=5, r=5 // if there are no children on a side, return the value passed into the method For all of your homework assignments: Put all your code in a single text file (extension must be .txt). An easy way to do this is run Notepad, then copy from Visual Studio into Notepad. I will not grade zip files unless the assignment specifically ask for a zip file. If you're using a mac, put your answer in a .docx or .pdf file. If and only if the assignment requires a drawing, you can submit a jpeg file

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

SQL For Data Science Data Cleaning Wrangling And Analytics With Relational Databases

Authors: Antonio Badia

1st Edition

3030575918, 978-3030575915

More Books

Students also viewed these Databases questions