answersLogoWhite

0


Best Answer

PROCEDURE POSTORDER(T)

[Given a binary tree whose root node address is given by the pointer variable T, this algorithm traverses the tree in postorder in an iterative manner].

1. [Initialize]

If T = NULL

then write ("Empty Tree")

return

else

P <-- T

TOP <-- 0

Call push(S,TOP,T).

2. [Process each stack branch address]

Repeat step 5 while TOP > 0.

3. [Descend left]

while P != NULL

call push(S,TOP,P)

P <-- LPTR(P)

4. [Process a node whose left and right subtree have been processed]

Repeat while S[TOP] > 0

P <-- pop(S,TOP)

write DATA(P)

if TOP = 0

return.

5. [Branch right and then mask node from which we branched]

P <-- RPTR(S[TOP]

S[TOP] <-- - S[TOP].

6. [FINISH]

return.

Firdous The Great :)

ICT Scholar.

User Avatar

Wiki User

13y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: Design a conventional iterative algorithm to traverse a binary tree represented in linked list in post order?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

Design a conventional iterative algorithm to traverse a binary tree represented in one dimensional array in in order?

InOrder_TreeTraversal() { prev = null; current = root; next = null; while( current != null ) { if(prev current.right) { prev = current; next = cuurent.parent; } current = next; } } Firdous Anjum The Great :) COMSATS Institute of Information Technology, Lahore


Design a conventional iterative algorithm to traverse a binary tree represented in linked lists in preorder?

PROCEDURE PREORDER(T) [Given a binary tree whose root node address is given by the pointer variable T, this algorithm traverses the tree in preorder in an iterative manner]. 1. [Initialize] If T = NULL then write ("Empty Tree") return else TOP &lt;-- 0. 2. [Process each stack branch address] Repeat step 3 while TOP &gt; 0. 3. [Get stored address and branch left] flag &lt;-- 0 while T != NULL while flag != 1 call push(S,TOP,T) write DATA(D) T &lt;-- LPTR(T) if T = NULL flag &lt;-- 1. 4. [Traverse the right side] D &lt;-- pop(S,TOP) T &lt;-- RPTR(D) flag &lt;-- 0 while T =NULL D &lt;-- POP(S,TOP) T &lt;-- RPTR(D) if TOP = 0 return. 5. [FINISH] return. Firdous Anjum Akbar. COMSATS Lahore.


What part of speech is traverse?

"Traverse" is a verb.


When was Traverse Legal created?

Traverse Legal was founded in 2005.


What is the Hebrew word for traverse?

to traverse = avar (&times;&cent;&times;&lsquo;&times;&uml;) or chatsah (&times;&mdash;&times;&brvbar;&times;&rdquo;)


Where is the Traverse Area District Library in Traverse City located?

The address of the Traverse Area District Library is: 610 Woodmere Avenue, Traverse City, 49686 3102


Where is the Grand Traverse Highlanders in Traverse City Michigan located?

The address of the Grand Traverse Highlanders is: 1600 Outer Dr W, Traverse City, MI 49685-8831


What county is traverse city located?

Grand Traverse County


When was To Traverse Water created?

To Traverse Water was created in 1992.


When was Zyrion Traverse created?

Zyrion Traverse was created in 2007.


What is the population of Traverse Legal?

Traverse Legal's population is 10.


When was Chevrolet Traverse created?

Chevrolet Traverse was created in 2008.