- 2074 Bhadra · 2+7 marks
Greedy best-first drawbacks; A*
Short answer
Greedy best-first expands the node with smallest h(n) but ignores g(n), so it is not optimal or complete. A* uses f(n) = g(n) + h(n); in the example greedy gives S-A-C-G costing 12, while A* returns S-B-G costing 9.
Why is searching important in problem solving? What are the drawbacks of greedy best-first search and how does the A* search algorithm solve them? Explain with an example.
Importance of searching
Most problems (route finding, puzzles, planning, games) are represented as a state space where no direct formula gives the answer. Search systematically explores the possible action sequences to find a path from the initial state to the goal, and finds the best one when many exist.
Greedy best-first search
It expands the node that appears closest to the goal, using only the heuristic: f(n) = h(n).
Drawbacks
- Not optimal: it ignores the cost already spent, g(n), so it may return a long path.
- Not complete: it can follow a misleading heuristic into a loop or dead end (unless repeated states are checked).
- Worst-case time and space O(b^m); it may expand many nodes if the heuristic is poor.
- Being greedy at every step, it can be fooled by local minima in h.
A* search
A* uses f(n) = g(n) + h(n), where g(n) = cost from the start to n and h(n) = estimated cost from n to the goal. With an admissible heuristic (one that never overestimates), A* is complete and optimal. Because g(n) is included, a path that has become expensive is abandoned, while the heuristic still guides the search towards the goal.
Example
Edges: S-A = 2, S-B = 5, A-C = 9, C-G = 1, B-G = 4. Heuristic: h(S) = 6, h(A) = 1, h(B) = 3, h(C) = 1, h(G) = 0 (admissible).
S
2 / \ 5
A B
9 | | 4
C |
1 | |
G---+
Greedy: from S, compare h(A) = 1 and h(B) = 3 and choose A; then C (h = 1); then G. Path S-A-C-G, cost 2 + 9 + 1 = 12.
A*:
| Step | Expand | f values generated |
|---|---|---|
| 1 | S | A: 2+1 = 3; B: 5+3 = 8 |
| 2 | A (f=3) | C: (2+9) + 1 = 12 |
| 3 | B (f=8) | G: (5+4) + 0 = 9 |
| 4 | G (f=9, lowest) | Goal |
A* returns S-B-G, cost 9, which is better than the greedy path (12). A* did not follow the attractive h(A) = 1, because it counted the high cost 9 of the edge A-C in g.
✓ Answer checked by Claude Opus 5.5 (high effort)
Related questions
- Well defined problem, state-space search · Artificial Intelligence, chapter 2
- Searching: BFS vs DFS comparison · Artificial Intelligence, chapter 3 · asked 5×
- Informed vs blind search; DFS vs BFS · Artificial Intelligence, chapter 3
- Problem space; BASE+BALL=GAMES · Artificial Intelligence, chapter 2
- Three students solving a problem · Probability and Statistics, chapter 1
- ID3 algorithm and why greedy · Data Mining, chapter 3
- Creative problem solving and brainstorming · Machine Design I, chapter 4
- Binary search with algorithm and example · Data Structure and Algorithm, chapter 8 · asked 4×