Amazon interview question

Write program for DFS and BFS