Could anyone give me an idea about how to print all the numbers in a binary search tree by inorder? Thx a lot!
Could anyone give me an idea about how to print all the numbers in a binary search tree by inorder? Thx a lot!
Please, try searching the forum next time first. These standard questions have been asked many times before.
http://cboard.cprogramming.com/showt...hlight=inorder
sure!
thx for ur help!
but I had a question about how this code works?
it seems that the recursion do not have a base case?
Code:if(Root!=NULL) { Inorder(Root->Left); printf("%s\n", Root->Data); Inorder(Root->Right); }
I love google!
Here is a wonderful explanation including source code (I think it's Pascal) and animated GIFs.
http://www.cs.usask.ca/resources/tut...ntree/2-2.html
>it seems that the recursion do not have a base case?
Looks like a base case to me:
Code:if(Root!=NULL) { Inorder(Root->Left); printf("%s\n", Root->Data); Inorder(Root->Right); }