DataStructure
Depth-First Search(DFS)
Depth-First Search 깊이 우선 탐색: 일단 나아가고 보는 traversal ex) Preorder, Post order traversal Algorithm DFS(G, v): mark v as "vistied"; for each ∈ neighbors(v): if w is "unvisited": DFS(G, u);Time Complexity if G is represented as adjancency list: O(n+m) In matrix: O(n^2) 알고리즘에 따른 경로 DFS(G, A): mark A as "visited" B is A's neighbors DFS(G, B) mark B as "visited" C is B's neighbors DFS(G, C) mark ..
2021. 1. 20. 01:09
최근댓글