Skip to content

기본 BFS 구현#134

Merged
programofktw merged 3 commits intomainfrom
basic
Jul 8, 2025
Merged

기본 BFS 구현#134
programofktw merged 3 commits intomainfrom
basic

Conversation

@programofktw
Copy link
Copy Markdown
Owner

#️⃣ 어떤 브랜치인가요?

  • basic
  • baekjoon
  • other:

📝 DFS 트리 구현

DFS (Depth-First Search)

DFS의 핵심은 "현재 위치를 처리한 뒤 연결된 다음 작업을 즉시 수행하는 것입니다."
즉 깊게 들어가 확장해나가는 방식으로 기준에 따른 깊이를 따라 처리해야하기에 먼저 들어간 작업보다 나중에 들어간 작업이 먼저 처리될 수 있는 Stack 자료 구조를 활용해야합니다.

이 때 Stack은 별도의 자료 구조를 통해 수동 관리를 할 수도, 메서드 함수 호출이 Stack 영역에 쌓인다는 것을 활용할 수도 있습니다

수동 관리하는 편이 메모리 복잡도로는 좋을 것이며
stack 영역을 활용하는 것은 메모리 복잡도는 올라가지만 구현이 간편해집니다

이런 특징을 가진 DFS의 경우 경로 탐색, 백트래킹, 조합/순열 탐색 등에 유용합니다.

@programofktw programofktw self-assigned this Jul 8, 2025
@programofktw programofktw merged commit 48e3b41 into main Jul 8, 2025
@programofktw programofktw changed the title BFS, DFS 코드 구현 BFS 구현 Jul 8, 2025
@programofktw programofktw changed the title BFS 구현 기본 BFS 구현 Jul 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant