in-order traversal this process when executed


In-order Traversal

 This process when executed iteratively also needs a stack and a Boolean to prevent the implementation from traversing any portion of a tree twice. The general process of in-order traversal follows the following steps:  

1.  push a NULL onto the stack.

2.  Starting with the root, proceed down the left side of the tree. As long as there is another left node following the present node, push the pointer to the current node onto the stack and move to the left node which follows it.

3.  When there are no more left nodes following the present node, process the current node.

4.  Check to see if the last left node has a right node (it obviously doesn't have a left node).

5.  If there is a right node then there is subtree to the right. This should be processed in following steps 2 to 4.

6.  If there is no right node then pop the last node from the stack (back up one node). Process this node and as this node has a left subtree that has already been processed, move to the right of the node and start looking for a left and right subtree again.  

 

Request for Solution File

Ask an Expert for Answer!!
Computer Engineering: in-order traversal this process when executed
Reference No:- TGS0282416

Expected delivery within 24 Hours