← 返回 oracle 的题目列表Bottom View of a Binary Tree
类型:online_judge
Given a binary tree, return its bottom view.
For every vertical line (same horizontal distance), keep the node that is deepest in the tree. If two nodes have the same depth and horizontal distance, keep the one visited later in level-order traversal.
The root has horizontal distance 0; a left child has distance parent - 1, and a right child has distance parent + 1.
Return node values from the leftmost horizontal distance to the rightmost. Explain the implementation, correctness, and complexity.