Algorithms, Data Structures, DFS, Bfs, Graphs.
neighbour of graph[currentNode]) { dfs(graph, neighbor, visited); } } // same graph could be used here const visited = new Set(); dfs(graph, 0, visited); Oh, you would say it looks better and more readable because of recursion. Yes. I also think so. Recursions work really better for situations when