Search Algorithms in AI
How AI agents explore possibilities to find a solution.
Why Search Matters in AI
Many AI problems â like solving a puzzle, finding a path, or playing a game â can be framed as searching through a space of possible states to reach a goal state.
Uninformed Search
Breadth-First Search (BFS) explores all neighbors before going deeper â guarantees the shortest path in unweighted graphs. Depth-First Search (DFS) explores as far as possible along one branch before backtracking â uses less memory but doesn't guarantee the shortest path.
Informed Search
Algorithms like A* use a heuristic (an estimate of distance to the goal) to search more efficiently than uninformed methods, balancing the actual cost so far with the estimated cost remaining.
đ Real-World Use
Google Maps uses an A*-like search algorithm to find the fastest route, using a heuristic (straight-line distance to destination) combined with real road distances/traffic to avoid exploring every possible road.
đĄ Pro Tip
When explaining A* in an interview, emphasize that it's 'informed' because of the heuristic â this single word (heuristic) is usually what distinguishes a strong answer from a basic one.
đ§Ē Quick Self-Test
Check what you just learned â no pressure, just practice.
1. Which search guarantees the shortest path in an unweighted graph?
2. What does A* search use to guide its search efficiently?