Thoughtworks interview question

BFS, DFS