[백준 1260] DFS와 BFS | 자바
·
📝 Coding Test/백준 Sliver
문제DFS와 BFS풀이import java.util.*;class Main { static int n; static int m; static int v; static boolean[] visited; static ArrayList> graph; static void dfs(int x) { visited[x] = true; System.out.print(x + " "); for(int next : graph.get(x)) { if(!visited[next]) { visited[next] = true; dfs(next); } } } static void bfs(int start) { Queue q = new LinkedLis..