[BFS] 너비 우선 탐색(BFS, Breadth-First Search)

너비 우선 탐색( BFS,Breadth-First Search)     int wall = 0; int pastCode = 1; int road = 2; int finishCode = 3; int front = -1; int rear = -1; List<Integer> queueI = Lists.newArrayList(); List<Integer> queueJ = Lists.newArrayList(); private int[][] getMap(){ int[][] map = { {0, 0, 0, 0, 0, 0, 0}, {0, 2, … Continue reading [BFS] 너비 우선 탐색(BFS, Breadth-First Search)

[dFS] 깊이 우선 탐색 (DEPTH-FIRST SEARCH)

  깊이 우선 탐색(DFS, Depth-First Search)   int wall = 0; int pastCode = 1; int road = 2; int finishCode = 3; int top = -1; List<Integer> stackI = Lists.newArrayList(); List<Integer> stackJ = Lists.newArrayList(); private int[][] getMap(){ int[][] map = { {0, 0, 0, 0, 0, 0, 0}, {0, 2, 2, 2, 2, 2, … Continue reading [dFS] 깊이 우선 탐색 (DEPTH-FIRST SEARCH)