What do you exactly mean by reverse postorder? In postorder the value is accessed after accessign all the left and the right children or branches.
So if you want reverse then it must mean preorder traversal.
[quote]
Preorder:
1. Print out the value and save the node or value to stack.
2. If left child not null call Preorder (left)
3. If right child not null call Preorder (right).
If this is not your problem stmt then restate it with examples.
Best of luck,
~s.o.s~
Failure as a human
11,938 posts since Jun 2006
Reputation Points: 3,281
Solved Threads: 734
So if you want reverse then it must mean preorder traversal.
It seems odd that he would state preorder as being reverse post order. Why not just as for a preorder traversal algo. But than nothing surprises me these days so you could be right?
iamthwee
Posting Expert
5,950 posts since Aug 2005
Reputation Points: 1,543
Solved Threads: 439
It seems odd that he would state preorder as being reverse post order. Why not just as for a preorder traversal algo. But than nothing surprises me these days so you could be right?
Yes its possible I may be wrong but lookign from his code and the limited senario he has painted in front of me, i thought maybe he didnt know about preorder and needed some direction. But then again you cant know the mind of these young developers, maybe he wouldb be the first one to write a technical paper on Reverse Postorder :mrgreen:
~s.o.s~
Failure as a human
11,938 posts since Jun 2006
Reputation Points: 3,281
Solved Threads: 734
Reverse postorder means you traverse each node's children from right to left.
Rashakil Fol
Super Senior Demiposter
2,658 posts since Jun 2005
Reputation Points: 1,135
Solved Threads: 177