Count BST nodes that lie in a given range
Given a Binary Search Tree (BST) and a range l-h(inclusive), count the number of nodes in the BST that lie in the given range.
- The values smaller than root go to the left side
- The values greater and equal to the root go to the right side
- Time : O(n)
- Space : O(d)
1 | int getCount(Node *root, int l, int h) { |