Uber Interview Question

find the k smallest values in a binary search tree.

Interview Answer

Anonymous

Jun 30, 2016

by doing in order traversal in the tree by using stack. we can find the minimum value which is the left most node and pop k-1 more element from the stack to get the k smallest values.