깊이 우선 탐색 - DFS
깊이
를 우선으로 탐색한다.Graph
나 Tree
구조의 자료구조를 탐색한다.
Recusive function
또는 Stack
을 이용하여 구현할 수 있다.순환 알고리즘
O(N^2)
, 인접 리스트로 구현된 그래프는 O(N+E)
가 걸린다.https://en.wikipedia.org/wiki/Depth-first_search
https://www.geeksforgeeks.org/depth-first-search-or-dfs-for-a-graph/
https://gmlwjd9405.github.io/2018/08/14/algorithm-dfs.html