05.23.2023
0. Background
There are tons of algorithm methods to solve problems out there and it sometimes confuses people with when an algorithm method is appropriate. In this article, I'd like to give suggestions through some situations.
1. DFS
Can be used as broute force
When a graph to be searched is large (the numorous number of nodes and edges)
When you need to keep a track of features of routes (BFS does not have information about routes)
2. BFS
Can be used as broute force
When the requirement is to get the shortest path (finding a way in a maze)
The first path found through BFS is the shortest path
To be updated..
'CS > Algorithm' 카테고리의 다른 글
[LeetCode] 46. Permutations (0) | 2024.01.03 |
---|---|
1912 연속합 with 파이썬 (feat. DP, 동적 프로그래밍) (0) | 2023.08.18 |
1717 set expression (집합의 표현) with Union-Find in Python3 (2) | 2023.04.23 |
18258 Queue2(큐2) with Python3 (0) | 2023.02.24 |
2839 Sugar Delivery (설탕배달) with Greedy Algorithm (0) | 2023.02.14 |