X Interview Question

Perform level-order traversal of an incomplete binary tree, i.e. certain nodes at a level could be empty.

Interview Answers

Anonymous

Feb 15, 2013

BFS

1

Anonymous

Mar 27, 2013

I am thinking DFS is better, because you know the level otherwise for BFS how do you find if the NULL is the end of your level or just a NULL node?