Recall & Review
beginner
What is Vertical Order Traversal of a Binary Tree?
It is a way to print the nodes of a binary tree column by column from left to right. Nodes in the same vertical line are grouped together.
Click to reveal answer
beginner
How do we assign horizontal distances (HD) to nodes in Vertical Order Traversal?
The root node is assigned HD = 0. For any node, its left child has HD = parent's HD - 1, and its right child has HD = parent's HD + 1.
Click to reveal answer
intermediate
Why do we use a queue and a map in Vertical Order Traversal?
A queue helps in level order traversal to process nodes level by level. A map stores nodes grouped by their horizontal distance for final vertical order output.
Click to reveal answer
intermediate
What data structure is commonly used to keep track of nodes and their horizontal distances during traversal?
A queue of pairs (node, horizontal distance) is used to process nodes in order and track their vertical positions.
Click to reveal answer
advanced
How do we handle nodes that share the same horizontal distance and level in Vertical Order Traversal?
They are printed in the order they appear in the level order traversal, usually from left to right.
Click to reveal answer
In Vertical Order Traversal, what horizontal distance is assigned to the root node?
✗ Incorrect
The root node is always assigned horizontal distance 0.
Which data structure is best to store nodes grouped by their horizontal distance?
✗ Incorrect
A map or dictionary stores nodes by their horizontal distance keys.
What traversal method is combined with horizontal distance tracking for Vertical Order Traversal?
✗ Incorrect
Level order traversal (BFS) is used to process nodes level by level.
If a node is at horizontal distance 2, where is it located relative to the root?
✗ Incorrect
Positive horizontal distance means right side of the root.
How do we print the final vertical order after traversal?
✗ Incorrect
We print nodes from the smallest to largest horizontal distance (left to right).
Explain step-by-step how to perform Vertical Order Traversal on a binary tree.
Think about how to combine level order traversal with horizontal distance tracking.
You got /5 concepts.
Describe how horizontal distances change when moving to left and right children in a binary tree.
Consider the root as the center point.
You got /3 concepts.