Recall & Review
beginner
What is the bottom view of a binary tree?
The bottom view of a binary tree is the set of nodes visible when the tree is seen from the bottom. It shows the last node at each horizontal distance from the root.
Click to reveal answer
beginner
How do we assign horizontal distances to nodes in a binary tree for bottom view?
We assign 0 to the root node. For the left child, horizontal distance is parent's distance minus 1. For the right child, it is parent's distance plus 1.
Click to reveal answer
intermediate
Which data structure is commonly used to track nodes and their horizontal distances in bottom view calculation?
A queue is used for level order traversal, and a map (or dictionary) stores the latest node at each horizontal distance.
Click to reveal answer
intermediate
Why does the bottom view use level order traversal instead of inorder or preorder?
Level order traversal processes nodes level by level, ensuring the bottom-most node at each horizontal distance overwrites previous nodes, giving the correct bottom view.
Click to reveal answer
advanced
What is the output of bottom view for this tree?<br>Root: 20<br>Left child: 8<br>Right child: 22<br>Left child of 8: 5<br>Right child of 8: 3<br>Right child of 22: 25<br>Left child of 3: 10<br>Right child of 3: 14
The bottom view nodes are: 5 -> 10 -> 3 -> 14 -> 25
Click to reveal answer
What horizontal distance is assigned to the root node in bottom view calculation?
✗ Incorrect
The root node is always assigned horizontal distance 0.
Which traversal method is best suited for computing the bottom view of a binary tree?
✗ Incorrect
Level order traversal processes nodes level by level, which helps identify the bottom-most nodes.
In bottom view, what happens when two nodes share the same horizontal distance?
✗ Incorrect
The bottom-most node at that horizontal distance is included in the bottom view.
Which data structure helps keep track of the latest node at each horizontal distance during bottom view calculation?
✗ Incorrect
A map stores the latest node for each horizontal distance.
If a node is at horizontal distance 2 and level 3, and another node is at horizontal distance 2 and level 4, which node appears in the bottom view?
✗ Incorrect
The node at the lower level (level 4) is visible from the bottom.
Explain how to compute the bottom view of a binary tree step-by-step.
Think about horizontal distances and level order traversal.
You got /5 concepts.
Describe why level order traversal is important for finding the bottom view of a binary tree.
Consider how nodes at the same horizontal distance but different levels are handled.
You got /4 concepts.