You are viewing a single comment's thread. Return to all comments →
void inOrder(node *root) { node* current,* pre; current=root; while(current){ if(!current->left){ cout<<current->data<<" "; current=current->right; }else { pre=current->left; while(pre->right&&pre->right!=current) pre=pre->right; if(!pre->right){ pre->right=current; current=current->left; }else { pre->right=NULL; cout<<current->data<<" "; current=current->right; } } }
} Morris algo without using stack and recursion
Seems like cookies are disabled on this browser, please enable them to open this website
Tree: Inorder Traversal
You are viewing a single comment's thread. Return to all comments →
} Morris algo without using stack and recursion