How do you find the kth smallest number in a binary search tree.
Anonymous
Inorder traversal the tree, the returned array is sorted, then find the Kth smallest number. O(n)time and O(n)space.Anyone has better idea?
Check out your Company Bowl for anonymous work chats.