Give the inorder,postorder& preorder forms of a tree in a single traversal
Traverse(s)
{
If(s)
{
Preorder_queue(s);
Traverse(s->left);
Inorder_queue(s);
Traverse(s->right);
Postorder_queue(s);
}
}
Subscribe to:
Post Comments (Atom)
DFS the life without backtracking
No comments:
Post a Comment