Node* x = TREE_MINIMUM(root);
for(int i = 0; i < k-1; i++){
x = TREE-SUCCESSOR(x);
}
return x;On Fri, Jul 29, 2011 at 11:08 AM, noobcoder <[email protected]> wrote: > Iterative inorder of tree till you have traversed k elements. Last > element is the kth smallest. > > On Jul 29, 10:10 am, AMAN AGARWAL <[email protected]> wrote: > > Please tell the solution of this question > > > > Given a Binary Search Tree, write a program to print the kth smallest > > element without using any static/global variable. You can’t pass the > value k > > to any function also > > -- > > AMAN AGARWAL > > "Success is not final, Failure is not fatal: It is the courage to > continue > > that counts!" > > -- > You received this message because you are subscribed to the Google Groups > "Algorithm Geeks" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/algogeeks?hl=en. > > -- Sunny Aggrawal B-Tech IV year,CSI Indian Institute Of Technology,Roorkee -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
