hi josgood...
Actually I am preparing for an interview.. I got this question from some other site, I tried but I cant able to solve it thats why I posted here..
Main Topics
Browse All TopicsGiven a Binary Search Tree, write a program to print the kth smallest element without using any static/global variable. You cant pass the value k to any function also.
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
As I see it, the limitations given are there to prevent a recursive solution. These limitations restrict you to automatic variables and prevent you from using function calls. So the job has to be done all in one function by iteration.
This is C language, so I would think the fundamentals to the solution would be
1) An array of size k, where in-progress answers are stored
2) Knowing which link, left or right, is the "lesser than" link
3) A "current node" pointer that is moved by iteration
4) At each node, updating the "size k array", if the node's value is less than highest number in the array
Does that make sense?
Business Accounts
Answer for Membership
by: josgoodPosted on 2008-07-06 at 13:15:04ID: 21941468
In this situation, I can't provide the answer, but I can guide you. The objective would be for you to know how to do it.
If that is acceptable to you, let me ask you a question.
What do you know about this already?