Using Morris Traversal, we can traverse the tree without using stack and recursion. The idea of Morris Traversal is based on Threaded Binary Tree. In 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