This is a question I thought it would be easy but I found I’m wrong in the last. I can finish the program without recursive but I want to ask whether this problem can be finished in recursive version or not?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
A recursive binary search tree traversal is basically (pseudo-code in case this is coursework):
That’s all there is to it really, just replace
doSomethingWith()with whatever you want to do (such as print).That will traverse in left to right order so, if your BST is ordered in such a way that left means lower, simply swap over the two
traversecalls.By way of example, consider the following tree:
as embodied in this example C program:
Running that program gives you the following output: