• Tutorials
  • DSA
  • Data Science
  • Web Tech
  • Courses
July 31, 2024 |5.1K Views

Remove BST keys outside the given range

  Share   Like
Description
Discussion


Given a Binary Search Tree (BST) and a range [min, max], remove all keys which are outside the given range. The modified tree should also be BST. For example, consider the following BST and range [-10, 13]. 
There are two possible cases for every node.

Node’s key is outside the given range. This case has two sub-cases. 
Node’s key is smaller than the min value. 
Node’s key is greater than the max value.

Remove BST keys outside the given range  : https://www.geeksforgeeks.org/remove-bst-keys-outside-the-given-range/