pre-order traversalthe method of doing a


Pre-order Traversal

The method of doing a pre-order traversal iteratively then has the several steps(suppose that a stack is available to hold pointers to the appropriate nodes):

1. push NULL onto the stack

2. Begin at the root and begin execution

3. Write the information in the node

4. If the pointer to the right is not NULL push the pointer onto the stack  

 5. if the pointer to the left is not NULL move the pointer to the node on the left

6. if the pointer to the left is NULL pop the stack

7. repeat steps 3 to 7 until no nodes remain

 

Request for Solution File

Ask an Expert for Answer!!
Computer Engineering: pre-order traversalthe method of doing a
Reference No:- TGS0282413

Expected delivery within 24 Hours