would it work temp=root; for(int i=0;i<k;i++) { temp=temp->left; } On Jul 29, 10:48 am, sunny agrawal <sunny816.i...@gmail.com> wrote: > 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 <ase.as...@gmail.com> 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 <mnnit.a...@gmail.com> 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 algogeeks@googlegroups.com. > > To unsubscribe from this group, send email to > > algogeeks+unsubscr...@googlegroups.com. > > 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 algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.