Tree Traversal

1. How is traversal of a tree different from traversal of a general graph?
Explanation

Explanation

Explanation

Explanation

Explanation

Explanation

Explanation

Explanation

2. We can uniquely reconstruct a binary tree with distinct node values using the results of which traversals?
Explanation

Explanation

Explanation

Explanation

Explanation

Explanation

Explanation

Explanation

3. To find the shortest distance in terms of number of edges from a starting vertex to every reachable vertex in an unweighted graph, which traversal can be used?
Explanation

Explanation

Explanation

Explanation

Explanation

Explanation

Explanation

Explanation

4. Let us assume a binary tree consisting of nodes a, b, c, d, e, f, g. If the postorder traversal on the tree gives {d, e, b, f, g, c, a}, then what are the preorder and inorder traversals respectively?
Explanation

Explanation

Explanation

Explanation

Explanation

Explanation

Explanation

Explanation

5. Consider a binary tree with root A, left child B, and right child C. B has children D and E. What is the level-order traversal?
Explanation

Explanation

Explanation

Explanation

Explanation

Explanation

Explanation

Explanation

6. Which traversal of a binary tree visits the root after both its left and right subtrees?
Explanation

Explanation

Explanation

Explanation

Explanation

Explanation

Explanation

Explanation

7. If a binary tree has nn nodes, what is the time complexity of preorder traversal when every node is visited exactly once?
Explanation

Explanation

Explanation

Explanation

Explanation

Explanation

Explanation

Explanation

8. Which traversal is most directly associated with a queue in its standard iterative implementation?
Explanation

Explanation

Explanation

Explanation

Explanation

Explanation

Explanation

Explanation

9. Consider a binary tree with root A, left subtree rooted at B, and right subtree rooted at C. B has children D and E, while C has children F and G. Which sequence is the postorder traversal?
Explanation

Explanation

Explanation

Explanation

Explanation

Explanation

Explanation

Explanation