Tuesday, July 1, 2014

Inorder Tree Traversal without recursion and without stack in java


Using Morris Traversal, we can traverse the tree without using stack and recursion. The idea of Morris Traversal is based on Threaded Binary TreeIn this traversal, we first create links to Inorder successor and print the data using these links, and finally revert the changes to restore original tree.

Program :




Reference:
http://www.geeksforgeeks.org/inorder-tree-traversal-without-recursion-and-without-stack/

No comments:

Post a Comment