Solve my Tree Problem.
Oct 21, 2012 at 12:49pm UTC
I have made a program for making and traversing Binary Search tree. My program is running Ok the only problem is when i am inserting nodes in order.
The post treveral is printing.
However according to my calculations it should print.
my Post treversal function is.
ANY WHERE HEAD IS ROOT NODE IN THE PROGRAMM.
2 3 4 5 6 7 8 9 10 11 void postorder(bst *temp)
cout<<temp->myData<< " ";
I am passing root node from my main program.
It seems ok to me the only problem should be in insertion, my be my program is not implementing the tree perfectly that's why it is not printing perfectly.
2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 void insert( int num)
bst *p= new bst(num);
It is in the class containing head as the element of class that's why it does not need the head pointer in the parameter. Head is root node.
Oct 21, 2012 at 12:59pm UTC
postorder calling the inorder?
Oct 21, 2012 at 1:02pm UTC
Victim of Copy paste, thanks...!-)
Topic archived. No new replies allowed.