Question: c# programming Add a method to the binary search tree class that returns false if the value passed into the method is not in the
c# programming 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 T left, ref T right) Example: 15 5 50 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, refr) returns true and I-45, r=95 aBst.ReturnEnds(9, refl, refr) returns false a Bst.ReturnEnds(5. refl. refr) returns true and I=5, r=5 // if there are no children on a side, return the value passed into the method
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
