Nth Highest Number in Binary Search Tree
Given a binary search tree and an integer n, return node with the nth highest value.
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!
...