BFS 1 [Algorithm] BOJ 1260 import java.util.*; public class Main { public static boolean[] dfsVisited; public static boolean[] bfsVisited; public static ArrayList graph = new ArrayList(); public static void dfs(int start) { dfsVisited[start] = true; System.out.print(start + " "); for (int i = 0; i < graph.get(start).size(); i++) { int x = graph.get(start).get(i); if (!dfsVisited[x]) dfs(x); } } public static void bfs(int .. Algorithm 2021. 7. 28. 이전 1 다음