Trace through tree [3,9,8,4,0,1,7].
Queue starts: [(3, col=0)]. Map: {}.
Process 3 at col . Map: {0:[3]}. Enqueue (9, -1), (8, 1).
Process 9 at col . Map: {0:[3], -1:[9]}. Enqueue (4, -2), (0, 0).
Process 8 at col . Map: {0:[3], -1:[9], 1:[8]}. Enqueue (1, 0), (7, 2).
Process 4 at col . Map adds {-2:[4]}.
Process 0 at col . Map: {0:[3,0]}.
Process 1 at col . Map: {0:[3,0,1]}.
Process 7 at col . Map: {2:[7]}.
Sort by column: [[4],[9],[3,0,1],[8],[7]].
time for sorting columns. space.