Amazon interview question

Know how to implement DFS and BFS well