Question: Question No:3 (15 marks) Write a C++ code for given an array as {14, 13, 10.9, 8, 7, 6, 5, 4, 3. 1) construct the

 Question No:3 (15 marks) Write a C++ code for given an

Question No:3 (15 marks) Write a C++ code for given an array as {14, 13, 10.9, 8, 7, 6, 5, 4, 3. 1) construct the binary search tree. Write three functions as: a) printTree ) print the BST using array and identifying the root of BST. b) printRange() that given the pointer to the root to a BST, a low key value, and a high key value, prints in all sorted order records whose key values fall between the two given keys. Function printRange() should visit as few nodes in the BST as possible. c) removeOutsideRange() that takes range (4.9) as an input argument and remove all keys which are outside the given range in linear time. The modified tree should also be BST

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!