Question: 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

 Add a method to the binary search tree class that returns

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

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