ThousandEyes interview question

Q: Implement a BFS and a DFS