Nth Highest Number in Binary Search Tree
Explore techniques to find the nth highest node in a binary search tree. Understand reverse in-order traversal and how using stored subtree counts optimizes the search. This lesson covers time and space complexities for balanced and degenerate trees.
Statement
Given the root of a binary search tree and an integer value n, find the node with the n highest value.
Example
Consider the following BST as an example:
In this BST:
-
The highest node is 350.
-
The highest node is 200.
-
The highest node is 125.
-
The highest node is 100.
And so on!
...