Step 1: Start at root node 1 with column 0 and row 0
Queue: [(1, col=0, row=0)]
Columns map: {}Why: We begin traversal from root at center column 0
Step 2: Pop node 1, add value 1 to column 0 at row 0
Columns map: {0: [(0,1)]}
Queue: [(2, col=-1, row=1), (3, col=1, row=1)]Why: Node 1 is at column 0, row 0; add children with updated columns and rows
Step 3: Pop node 2, add value 2 to column -1 at row 1
Columns map: {0: [(0,1)], -1: [(1,2)]}
Queue: [(3, col=1, row=1), (4, col=-2, row=2), (5, col=0, row=2)]Why: Node 2 is left child, column decreases by 1, row increases by 1
Step 4: Pop node 3, add value 3 to column 1 at row 1
Columns map: {0: [(0,1)], -1: [(1,2)], 1: [(1,3)]}
Queue: [(4, col=-2, row=2), (5, col=0, row=2), (6, col=2, row=2)]Why: Node 3 is right child, column increases by 1, row increases by 1
Step 5: Pop node 4, add value 4 to column -2 at row 2
Columns map: {0: [(0,1)], -1: [(1,2)], 1: [(1,3)], -2: [(2,4)]}
Queue: [(5, col=0, row=2), (6, col=2, row=2)]Why: Node 4 is left child of 2, column decreases by 1 again
Step 6: Pop node 5, add value 5 to column 0 at row 2
Columns map: {0: [(0,1),(2,5)], -1: [(1,2)], 1: [(1,3)], -2: [(2,4)]}
Queue: [(6, col=2, row=2)]Why: Node 5 is right child of 2, column back to 0
Step 7: Pop node 6, add value 6 to column 2 at row 2
Columns map: {0: [(0,1),(2,5)], -1: [(1,2)], 1: [(1,3)], -2: [(2,4)], 2: [(2,6)]}
Queue: []Why: Node 6 is right child of 3, column increases by 1 again
Step 8: Sort nodes in each column by row and extract values
Final vertical order: [[4], [2], [1,5], [3], [6]]
Why: Sorting by row ensures top to bottom order in each vertical column
Result: Columns from left to right:
-2: 4
-1: 2
0: 1 -> 5
1: 3
2: 6
Output: [[4], [2], [1,5], [3], [6]]