Search Algorithms
Search finds a path from start to goal on a graph of states. Uninformed: BFS, DFS, UCS — no hint about the goal. Informed: greedy, A* — use a heuristic h(n). Adversarial: minimax when an opponent plays. Always say state, action, cost.
Campus map: rooms as nodes, corridors as edges. BFS finds fewest doors if every door costs 1. A* if walking time differs. Don’t start coding before you draw the tiny graph.
Search Algorithms — output — ['A', 'B', 'D'] (or A-C-D). Queue = fewest doors if each edge costs 1.
start
│
├── BFS (queue, fewest steps)
├── DFS (stack, deep first)
└── A* (g+h, if heuristic OK)
│
▼
goalBFS vs A* in one sentence each.