The only way remains is to use the iterative method of traversing a BST in 
in-order (you have to use a Stack to keep track of father).
The place where you print the value of the node, put a condition before that

if (!(--k)){
   print value_of_node;
}

in the outermost loop where you check
"while(no more nodes to traverse)"
, add the condition that "( && k != 0)"
^^ This will keep a check on value of k after each loop run.

Hope I am clear in explaining.

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/algogeeks/-/aHwinvhUrs4J.
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.

Reply via email to