| | |
recursive algorithm
Please support our C++ advertiser: Intel Parallel Studio Home
![]() |
•
•
Join Date: Nov 2004
Posts: 7
Reputation:
Solved Threads: 0
hi, can someone help me with writing down a recursive algorithm for traversing a binary tree in reverse-postorder that also returns the rank of each node? So far i have (and i know thatit isnt much but this problem giving me issues).
i hope that someone can give me some serious help thanks in advance
C++ Syntax (Toggle Plain Text)
postorder: save current posistion if(lchild) move to lchild postorder if(sibling) move to sibling postorder endif endif restore saved position visit//do something with the node
i hope that someone can give me some serious help thanks in advance
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,
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,
I don't accept change; I don't deserve to live.
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:
I don't accept change; I don't deserve to live.
![]() |
Similar Threads
- MIPS Recursive Programming, Help please! (Assembly)
- algorithm problem with recursion (Java)
- recursive findaverage function for Binary search tree (C)
- binary trees (C)
- Can you guys help me? about Quick Sort Algorithm (C)
- recursive algorithm (C)
Other Threads in the C++ Forum
- Previous Thread: Arrays?
- Next Thread: GetFile Help.
| Thread Tools | Search this Thread |
api array arrays based beginner binary c++ c/c++ calculator char char* class classes code compile compiler console conversion count delete deploy desktop directshow dll download dynamic dynamiccharacterarray encryption error file forms fstream function functions game givemetehcodez google graph gui homeworkhelp homeworkhelper iamthwee ifstream input int integer java lib linkedlist linker linux list loop looping loops map math matrix memory news number numbertoword output parameter pointer problem program programming project python random read recursion recursive reference return rpg sorting string strings struct temperature template templates test text text-file tree unix url variable vector video visual visualstudio win32 windows winsock wordfrequency wxwidgets






