Write Algorithm For Dfs And Bfs Problems