Interview Question

Interview(Student Candidate) Sunnyvale, CA

Print nodes visited in the level order traversal. Nodes of

  each level should be on a single line.

Interview Answer

2 Answers


I answered the case where we can add the depth variable to the class Node. The other case was to keep track of the number of elements in the next level.

Interview Candidate on Jan 11, 2011

Why not a simple BFS

Suraj Chandran on Feb 19, 2011

Add Answers or Comments

To comment on this, Sign In or Sign Up.