Question: Given the following code as a starting point, you should write a PrintinRange method for the Binary Search Tree. The PrintlnRange method will work in

 Given the following code as a starting point, you should writea PrintinRange method for the Binary Search Tree. The PrintlnRange method willwork in a way that's similar to the Print method that you've

Given the following code as a starting point, you should write a PrintinRange method for the Binary Search Tree. The PrintlnRange method will work in a way that's similar to the Print method that you've seen in clas EXCEPT THAT it will only print out the values in tree tha values 1, 3, 4, 5, 16), then PrintInRange(3,6) will print 3, 4, 5. Note that the ends of the range are INCLUSIVE, so if the values 3 or 6 were in a tree then PrintInRange(3,6) will print them both out t are within a specified range. So if a tree contains the Furthermore, the following program: Line Program Text class Program 3 BST bst new BST // Print_ empty tree 5 6 bst.PrintInRange (1, 10) 8 // Add a single value: bst. Add (10) Console.WriteLine ("PrintinRange : {101: bst.PrintInRange (1, 10) 10 12 13 14. 15 16 / Add several values: bst.Add (5)i bst.Add (1); bst.Add (7) bst.Add (15); bst.Add (11); bst.Add (20); Console.Writeline("PrintInRange: (1, 5, 7, 10, 11, 15 18 19 20. 21. 22. bst.PrintInRange (6, 10); 23 24 should produce this output Tree is empty! Key: 10 Key: 7 Key: 10 ur job is to take the provided code (below), and implement the specified method: Line 1 Program Text class BSTNode ublic int Data; public BSTNode Left 3 ublic BSTNode Right; public BSTNode (int data) Data data; 5 6 7 / / program contin ues on next paqe

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!