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?
The root node is assigned horizontal distance 0. Left child nodes get horizontal distance -1 from their parent, right child nodes get +1. This helps track nodes vertically.
Click to reveal answer
intermediate
Which data structure is commonly used to track nodes and their horizontal distances during bottom view traversal?
A queue is used for level order traversal, and a map (dictionary) stores the latest node at each horizontal distance.
Click to reveal answer
intermediate
Why does the bottom view keep updating the node at a horizontal distance during traversal?
Because nodes at lower levels overwrite nodes at the same horizontal distance seen earlier, ensuring the bottom-most node is recorded.
Click to reveal answer
intermediate
What is the time complexity of finding the bottom view of a binary tree?
The time complexity is O(n), where n is the number of nodes, because each node is visited once during level order traversal.
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?
✗ Incorrect
Level order traversal visits nodes level by level, which helps update bottom view nodes correctly.
In bottom view, if two nodes share the same horizontal distance, which one is visible?
✗ Incorrect
The node at the lower level (closer to bottom) is visible in bottom view.
What data structure stores the latest node at each horizontal distance during bottom view computation?
✗ Incorrect
A map/dictionary stores nodes keyed by their horizontal distance.
What is the output of bottom view for a tree with only root node?
✗ Incorrect
With only root node, bottom view is just the root node.
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 preferred over inorder or preorder for bottom view.
Consider how nodes at same horizontal distance but different levels are handled.
You got /4 concepts.