Comparison of Uninformed Search Strategies
Prerequisites
- BFS, DFS, DLS, IDDFS, UCS, Bidirectional — Individual algorithm pages
- State Space — Branching factor b, depth d, maximum depth m
🎯 Learning Objectives
- Compare all six uninformed search strategies in a single master table
- Understand when to choose each strategy based on problem constraints
- Apply a decision flowchart to select the right algorithm
- Answer GATE-style comparison questions confidently
1. The Master Comparison Table
This is the single most important table in uninformed search. Memorise it for GATE.
Notation: b = branching factor, d = depth of shallowest solution, m = maximum depth of search tree, l = depth limit, C* = optimal path cost, ε = minimum step cost.
| Criterion | BFS | UCS | DFS | DLS | IDDFS | Bidirectional |
|---|---|---|---|---|---|---|
| Complete? | Yes1 | Yes2 | No3 | No4 | Yes1 | Yes1 |
| Optimal? | Yes5 | Yes | No | No | Yes5 | Yes5 |
| Time | O(bd) | O(b1+⌊C*/ε⌋) | O(bm) | O(bl) | O(bd) | O(bd/2) |
| Space | O(bd) | O(b1+⌊C*/ε⌋) | O(b·m) | O(b·l) | O(b·d) | O(bd/2) |
| Data Structure | FIFO Queue | Priority Queue | LIFO Stack | LIFO Stack | LIFO Stack | 2 × FIFO Queue |
| Goal Test | At generation | At expansion | At generation | At generation | At generation | Intersection check |
💡 Footnotes for GATE Precision
- 1 If b is finite (and graph search avoids infinite loops for BFS/IDDFS/Bidirectional).
- 2 If step cost ≥ ε > 0 (positive minimum step cost).
- 3 DFS can get stuck in infinite branches (tree search) or infinite loops (without graph search).
- 4 DLS fails if d > l (solution deeper than limit).
- 5 Optimal only when all step costs are equal (unit cost). For variable costs, use UCS.
2. Detailed Discussion of Each Strategy
2.1 Breadth-First Search (BFS)
- Strengths: Complete, optimal (unit costs), simple to implement.
- Weakness: Exponential memory — stores the entire frontier (O(bd)). This is its fatal flaw. For b = 10 and d = 12, BFS needs ~1012 nodes in memory — over 10 TB!
- Best for: Small search spaces, shallow solutions, unit-cost problems where memory is sufficient.
2.2 Uniform-Cost Search (UCS)
- Strengths: Complete and always optimal (with ε > 0), handles variable step costs.
- Weakness: Explores in all directions equally (no heuristic guidance), potentially large frontier.
- Best for: Weighted graphs where step costs vary. When all costs are equal, UCS degenerates to BFS.
2.3 Depth-First Search (DFS)
- Strengths: Minimal memory — O(b·m). Can find solutions quickly in deep, narrow trees.
- Weakness: Neither complete nor optimal. Can wander into infinite branches or find suboptimal solutions.
- Best for: Problems where many solutions exist at similar depths, or when memory is extremely limited.
2.4 Depth-Limited Search (DLS)
- Strengths: Avoids infinite-depth problem of DFS by imposing limit l.
- Weakness: Not complete if d > l. Not optimal. Choosing the right l is difficult.
- Best for: Predecessor step for IDDFS. Rarely used on its own.
2.5 Iterative Deepening DFS (IDDFS)
- Strengths: Combines the best of BFS and DFS — complete, optimal (unit cost), and uses only O(b·d) memory. The repeated work at shallow depths is negligible (only a factor of b/(b−1)).
- Weakness: Time is O(bd) (same as BFS). Not optimal with variable costs.
- Best for: The preferred uninformed search method when solution depth is unknown and memory is limited.
2.6 Bidirectional Search
- Strengths: Dramatic speedup to O(bd/2) in time and space.
- Weakness: Requires explicit goal state, reversible operators, complex implementation.
- Best for: Problems with a known unique goal and easily reversible actions (e.g., route finding).
3. Decision Flowchart: Which Algorithm to Choose?
Use this decision process to select the appropriate uninformed search strategy:
Algorithm Selection Flowchart
START: Do you have variable step costs?
|
+-- YES → Use UCS
|
+-- NO (unit costs) →
|
Is the goal state explicit & operators reversible?
|
+-- YES → Use Bidirectional BFS
|
+-- NO →
|
Is the solution depth known approximately?
|
+-- YES → Use DLS (with limit = estimated depth)
|
+-- NO →
|
Is memory very limited?
|
+-- YES → Use IDDFS ★
|
+-- NO →
|
Is the search space small enough for BFS?
|
+-- YES → Use BFS
|
+-- NO → Use IDDFS ★
★ IDDFS is the default recommendation among uninformed strategies when no special conditions apply.
4. Key Trade-Offs
4.1 Time vs. Space
| Algorithm | Time | Space | Trade-Off |
|---|---|---|---|
| BFS | O(bd) | O(bd) | Both exponential — space is the bottleneck |
| DFS | O(bm) | O(b·m) | Great space, terrible time (m can be ≫ d) |
| IDDFS | O(bd) | O(b·d) | Best combo — BFS-level time, DFS-level space |
| Bidirectional | O(bd/2) | O(bd/2) | Dramatic time savings, still exponential space |
4.2 Completeness vs. Efficiency
DFS and DLS sacrifice completeness for space efficiency. IDDFS restores completeness while keeping low space usage. The overhead of re-expanding shallow nodes is:
Overhead factor = b/(b−1). For b = 10: 10/9 ≈ 1.11 — only 11% extra work.
4.3 Optimality vs. Generality
BFS and IDDFS are optimal only for unit-cost problems. UCS is optimal for any non-negative step costs but may explore more states than BFS in the unit-cost case (negligible difference in practice). For GATE, always clarify the cost model before answering optimality questions.
5. Memory Requirements: Practical Numbers
Assuming each node takes 1 KB of storage and b = 10:
| Depth d | BFS Memory | IDDFS Memory | Bidirectional Memory |
|---|---|---|---|
| 4 | 100 KB | 40 bytes | 200 bytes |
| 6 | 1 GB | 60 bytes | 2 KB |
| 8 | 100 GB | 80 bytes | 20 KB |
| 10 | 10 TB | 100 bytes | 200 KB |
| 12 | 1 PB | 120 bytes | 2 MB |
| 14 | 100 PB | 140 bytes | 20 MB |
💡 IDDFS Memory Advantage
IDDFS stores only the nodes on the current path (O(b·d) nodes). At d = 10 with b = 10, that is only 100 nodes (100 KB), while BFS needs 10 billion nodes (10 TB). This is why IDDFS is the preferred uninformed strategy in practice.
6. GATE-Style Comparison Questions
Question 1
Q: Which uninformed search strategy is complete, optimal (unit costs), and uses O(b·d) space?
A: Iterative Deepening DFS (IDDFS). It combines BFS’s completeness and optimality with DFS’s linear space usage.
Question 2
Q: An agent must find the cheapest path in a weighted graph where edge costs range from 1 to 10. Which uninformed search guarantees an optimal solution?
A: UCS. It is the only uninformed strategy that guarantees optimality with variable step costs (as long as costs are ≥ ε > 0).
Question 3
Q: In a tree-search version of DFS on a state space with infinite depth but finite branching factor, is DFS complete?
A: No. DFS can descend infinitely along one branch and never return. Graph search with cycle detection helps, but tree-search DFS is not complete in infinite-depth spaces.
Question 4
Q: For b = 10 and d = 8, approximately how many nodes does bidirectional BFS explore compared to standard BFS?
A: BFS: 108 = 100,000,000. Bidirectional: 2 × 104 = 20,000. Ratio: 5,000:1.
Question 5
Q: Which uninformed search strategies are NOT complete? (Select all that apply.)
A: DFS (infinite branches) and DLS (if d > l). All others (BFS, UCS, IDDFS, Bidirectional) are complete under their respective conditions.
Question 6
Q: An agent needs to search a very large state space with unknown solution depth, limited memory, and unit step costs. Which algorithm should it use?
A: IDDFS. It is complete, optimal for unit costs, and uses only O(b·d) memory — ideal for large, memory-constrained problems.
7. Quick-Reference: When to Use Each
| Algorithm | Use When… | Avoid When… |
|---|---|---|
| BFS | Small state space, unit costs, need guaranteed shortest path | Large/deep state space (memory explosion) |
| UCS | Variable step costs, need optimal path | Unit-cost problems (overkill; use BFS/IDDFS) |
| DFS | Need any solution fast, many solutions exist, memory is tiny | Need optimal/shortest path, or space has infinite depth |
| DLS | Known maximum depth of solution | Unknown solution depth (risk of failure) |
| IDDFS | Unknown depth, limited memory, unit costs | Variable step costs (use UCS instead) |
| Bidirectional | Explicit goal state, reversible operators, very large state space | Abstract goal test, irreversible actions |
8. Common Mistakes in GATE
- Mistake: Saying BFS is always optimal. Correction: BFS is optimal only with unit step costs. For variable costs, use UCS.
- Mistake: Claiming DFS uses O(m) space. Correction: DFS stores the current path plus siblings at each level, giving O(b·m) space.
- Mistake: Thinking IDDFS is wasteful due to repeated work. Correction: The overhead is only b/(b−1), which is ≤ 2 for b ≥ 2, and only ~11% for b = 10.
- Mistake: Confusing “complete” with “optimal.” Correction: Complete = guaranteed to find a solution. Optimal = guaranteed to find the best solution. DFS is neither; BFS is complete but not always optimal.
- Mistake: Applying bidirectional search without checking prerequisites. Correction: It needs an explicit goal state and reversible operators.
Summary
- The master comparison table covers completeness, optimality, time, space, and data structure for all six strategies.
- IDDFS is the preferred uninformed method: complete, optimal (unit costs), O(b·d) memory.
- UCS is the only uninformed method optimal for variable step costs.
- Bidirectional search offers dramatic speedup (O(bd/2)) but requires special conditions.
- For GATE: memorise the table, understand the trade-offs, and use the decision flowchart.
References
- Russell & Norvig, AIMA, Chapter 3.4 (Table 3.1).
- Korf, R. E. (1985). “Depth-First Iterative-Deepening.” Artificial Intelligence, 27(1), 97–109.