Showing posts with label NthLargestNode. Show all posts
Showing posts with label NthLargestNode. Show all posts

Wednesday, March 14, 2012

Nth largest node in a BST

Find the Nth largest node in a BST.


Example BST:
Code input/output:


inorder: 

1 3 4 6 7 8 10 13 14 
Size of BST: 9
1 largest node: 1
2 largest node: 3
3 largest node: 4
4 largest node: 6
5 largest node: 7
6 largest node: 8
7 largest node: 10
8 largest node: 13
9 largest node: 14