본문 바로가기
CS/Algorithm

When to Choose Which algorithm method

by 빠니몽 2023. 5. 18.

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..