Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
#️⃣ 어떤 브랜치인가요?
📝 DFS 트리 구현
DFS (Depth-First Search)
DFS의 핵심은 "현재 위치를 처리한 뒤 연결된 다음 작업을 즉시 수행하는 것입니다."
즉 깊게 들어가 확장해나가는 방식으로 기준에 따른 깊이를 따라 처리해야하기에 먼저 들어간 작업보다 나중에 들어간 작업이 먼저 처리될 수 있는 Stack 자료 구조를 활용해야합니다.
이 때 Stack은 별도의 자료 구조를 통해 수동 관리를 할 수도, 메서드 함수 호출이 Stack 영역에 쌓인다는 것을 활용할 수도 있습니다
수동 관리하는 편이 메모리 복잡도로는 좋을 것이며
stack 영역을 활용하는 것은 메모리 복잡도는 올라가지만 구현이 간편해집니다
이런 특징을 가진 DFS의 경우 경로 탐색, 백트래킹, 조합/순열 탐색 등에 유용합니다.