AI Notes
Understanding DFS, BFS, UCS, and A*
2026-05-08
1. Depth-First Search
Depth-first search explores one path as deeply as possible before backtracking. It is simple and memory-efficient, but it does not always find the shortest path.
2. Breadth-First Search
Breadth-first search expands nodes level by level. When every step has the same cost, BFS can find the shortest path.
3. Uniform Cost Search
Uniform cost search always expands the node with the lowest total path cost so far. It is suitable when different actions have different costs.
4. A* Search
A* search combines the actual cost from the start state and a heuristic estimate to the goal. With an admissible heuristic, A* can find an optimal solution efficiently.