Meta Interview Question

Print tree level by level, with a new line for each level

Interview Answers

Anonymous

Nov 28, 2012

breadth depth search is the most optimal here, but keeping track of when you're on a new level is quite difficult if the tree is not perfectly balanced.

Anonymous

Dec 4, 2012

In python, this would work: http://pastie.org/5478481 It's similar to a BFS, but with the extras to keep track of the level.