In-order traversal of a BST yields values in sorted order.
Iterative in-order traversal with a stack. Decrement k when visiting each node; when k==0, return that value.
The k-th visited node in in-order is the k-th smallest.
In-order traversal of a BST yields values in sorted order.
Iterative in-order traversal with a stack. Decrement k when visiting each node; when k==0, return that value.
The k-th visited node in in-order is the k-th smallest.