FAI Study Hub
← Back to Study Hub
Module 03 · Uninformed Search
← Hub
Intuition Properties DLS & IDS Hill Climbing Traps Past Papers Visualizer Quiz Checklist
Module 03 · Blind Search & Local Optimization

Uninformed Search & Traversal

Systematic graph exploration and local optimization. Step-by-step state space traces for Breadth-First Search (BFS), Depth-First Search (DFS), Depth-Limited Search (DLS) with cutoff limit $L=2$, Iterative Deepening Search (IDS), and Hill Climbing structural hazards.

Nov 2025 (Q3 20M, Q4 5M) May 2025 (Q7 10M) DFS (10 Nodes) DLS L=2 (7 Nodes) Hill Climbing Hazards

01. Intuition & Concept Contrast

Uninformed (blind) search algorithms operate without domain heuristics; they know only how to generate successor states and test whether a state is the goal.

Exploration Pattern

BFS (FIFO Queue) vs DFS (LIFO Stack)

Breadth-First Search (BFS): Expands the shallowest unexpanded node first. Explores level by level across the breadth. Complete and optimal for uniform step costs, but consumes exponential memory ($O(b^d)$) because it must store all active fringe nodes in RAM.

Depth-First Search (DFS): Expands the deepest unexpanded node first along a single path before backtracking. Incomplete on infinite trees and non-optimal, but uses modest linear memory ($O(bm)$).

Hybrid Optimization

DLS vs Iterative Deepening (IDS)

Depth-Limited Search (DLS): Enforces an artificial depth cutoff boundary at depth $L$. Solves DFS infinite-loop failures, but fails if the goal lies beyond depth $L$.

Iterative Deepening Search (IDS): Calls DLS with progressively increasing limits ($L = 0, 1, 2, \dots$). Combines the best of both worlds: optimal and complete like BFS, with the tiny linear memory footprint of DFS ($O(bd)$).

02. Comprehensive Search Properties Comparison Matrix

Guaranteed University Question (10 Marks). Comparing uninformed search algorithms across 4 standard criteria.

Search Algorithm Data Structure Complete? Optimal? Time Complexity Space Complexity
Breadth-First Search (BFS) FIFO Queue Yes (if $b$ finite) Yes (if step cost = 1) $O(b^d)$ $O(b^d)$ (Exponential RAM)
Uniform-Cost Search (UCS) Priority Queue (by $g$) Yes (if costs $\ge \epsilon$) Yes (Any step cost) $O(b^{1 + \lfloor C^* / \epsilon \rfloor})$ $O(b^{1 + \lfloor C^* / \epsilon \rfloor})$
Depth-First Search (DFS) LIFO Stack No (infinite trees) No (can find long path) $O(b^m)$ $\mathbf{O(bm)}$ (Linear!)
Depth-Limited Search (DLS) LIFO Stack (Limit $L$) Yes (if goal $d \le L$) No $O(b^L)$ $\mathbf{O(bL)}$
Iterative Deepening (IDS) LIFO Stack (Repeated) Yes (if $b$ finite) Yes (if step cost = 1) $O(b^d)$ $\mathbf{O(bd)}$ (Optimal + Linear)
Where $b$ = branching factor, $d$ = depth of shallowest goal, $m$ = maximum tree depth, $L$ = depth limit.

03. Depth-Limited Search (DLS) Mechanics

Nov 2025 (Q3.b) Exam Walkthrough. Why DLS cuts off leaves and how it prevents infinite loops.

The Cutoff Protocol:

In standard DFS, the algorithm follows left branches indefinitely. If a tree has depth $m = \infty$, DFS gets trapped in an infinite loop.

DLS introduces a boundary $L$. When generating nodes at depth $L$:

  • The algorithm visits and tests node at depth $L$.
  • It **does NOT generate or expand any child nodes** beneath depth $L$.
  • Child nodes are flagged as **pruned by cutoff**, and the search immediately backtracks to the parent level.
Why Iterative Deepening is Optimal Despite Repeated Work:
Students often assume IDS wastes time re-expanding upper levels. In an exponential tree with branching factor $b \ge 2$, the vast majority of nodes reside at the bottom level ($d$).
$$\text{Ratio} = \frac{b^d + b^{d-1} + \dots}{b^d} \approx \frac{b}{b - 1}$$ For $b = 10$, re-expansion overhead is only about $11\%$, a tiny price to pay for switching space complexity from gigabytes down to kilobytes!

04. Hill Climbing Local Search & The 3 Hazards

Nov 2025 (Q4.a) Guaranteed 5-Mark Question. Greedy local search without memory.

The Hill Climbing Invariant
$$\text{Move to neighbor } n' \iff \operatorname{Value}(n') > \operatorname{Value}(n)$$ Halts when no neighboring state has a higher value.
Hazard 01

Local Maxima

A peak that is higher than all its immediate neighbors, but lower than the global optimum. Because hill climbing cannot take downhill moves, it gets stuck permanently.

Remedy: Random-Restart Hill Climbing (conduct multiple searches from uniformly distributed random start states).

Hazard 02

Plateaus & Flat Shoulders

An area of the state space where the evaluation landscape is flat (zero gradient). All neighbors have the exact same score.

Remedy: Allow a limited number of sideways moves (e.g., max 100 sideways steps before aborting).

Hazard 03

Ridges

A sequence of local peaks where the slope is steep along edges but gentle along the spine. The greedy search oscillates back and forth across the narrow ridge, making negligible progress along the spine.

Remedy: Simulated Annealing: Probabilistically accept suboptimal downhill moves based on temperature $T$ with Boltzmann probability $P = e^{\Delta E / T}$. As $T \to 0$, it settles smoothly into the global peak.

05. Notation Decoding Matrix

Symbol Formal Name Plain-English Meaning Exam Benchmark
$b$ Branching Factor Average number of child nodes generated per node $b = 2$ in binary search trees
$d$ Goal Depth Depth of shallowest goal node in tree $d = 2$ in Nov 2025 exam tree
$m$ Maximum Depth Deepest possible path in state space $m = 3$ in Nov 2025 tree ($H, I, K$)
$L$ Depth Limit Pre-set cutoff boundary for Depth-Limited Search $L = 2$ in Nov 2025 exam question
$\Delta E$ Energy Difference $\operatorname{Value}(n') - \operatorname{Value}(n)$ in Simulated Annealing Negative when neighbor is worse

06. Repeatable Step-by-Step Solving Protocol

Step 1: Set Up Node Stack and Unvisited Set

Push Root node $A$ onto the LIFO stack: $\text{Stack} = [A]$.

Step 2: Pop Current Node & Check Goal

Pop top node. If it matches Goal node, halt and output path.

Step 3: Push Successors in Reverse Tie-Break Order

To visit Left children before Right children, push Right child first, then Left child so Left is at the top of the LIFO stack!

Step 4: For DLS, Enforce Depth Check ($d \le L$)

If node depth $= L$, do NOT push its successors to the stack. Mark sub-branches as cutoff and backtrack immediately.

Step 5: Write Visited Node Order Clearly

List visited nodes separated by arrows: $A \to B \to \dots \to G$.

07. 6 Deadly Exam Traps & Common Student Mistakes

Trap 01: Stack Insertion Order Inversion

Pushing Left Child Before Right Child

In a LIFO stack, the last item pushed is the first popped. If you push Left child first, the Right child will be popped first! Push Right child first to explore Left first.

Trap 02: Visiting Pruned Leaves in DLS

Listing Leaves at Depth $L+1$

In DLS with $L=2$, nodes $H, I, K$ at depth 3 must NEVER appear in the visited list. They are pruned at depth 2.

Trap 03: Claiming DFS is Space-Hungry

Confusing BFS Space with DFS Space

BFS uses exponential space $O(b^d)$. DFS uses tiny linear space $O(bm)$. Claiming DFS has high space complexity is an automatic mark deduction.

Trap 04: Hill Climbing Memory Fallacy

Assuming Hill Climbing Can Backtrack

Hill Climbing maintains zero search tree history. It remembers only its current state. Once stuck at a local maximum, it cannot backtrack on its own.

Trap 05: Goal Node Halting in DFS

Continuing Search After Goal is Reached

When the Goal node (Node G) is popped and visited, the algorithm must halt immediately. Do not continue exploring remaining stack items.

Trap 06: Zero-Indexed Depth Errors

Starting Depth Count at 1 Instead of 0

Root node $A$ is at **Depth 0**. Level 1 children are at Depth 1. Counting Root as Depth 1 shifts your cutoff limit by an entire level.

08. Complete University Question Bank (All Past PYQs Solved)

Nov 2025 · Question 3 Complete DFS vs DLS Traversal on 10-Node Tree (20 Marks)
Question Statement:
Given the tree configuration below, perform DFS traversal starting from root A. (10 Marks)
Perform Depth-Limited Search (DLS) with depth limit $L = 2$. Compare both methods. (10 Marks)
Depth 0: A (Initial node) / \ Depth 1: B C / \ / \ Depth 2: D E F G (Goal node) / / \ Depth 3: H I K

Solution:

a) Depth-First Search (DFS) Traversal Trace (10 Marks):
  1. Visit A: Push right child $C$, then left child $B$. Stack: $[C, B]$.
  2. Pop & Visit B: Push right child $E$, then left child $D$. Stack: $[C, E, D]$.
  3. Pop & Visit D: Push child $H$. Stack: $[C, E, H]$.
  4. Pop & Visit H: Leaf node at depth 3. Backtrack. Stack: $[C, E]$.
  5. Pop & Visit E: Push child $I$. Stack: $[C, I]$.
  6. Pop & Visit I: Leaf node at depth 3. Backtrack. Stack: $[C]$.
  7. Pop & Visit C: Push right child $G$, then left child $F$. Stack: $[G, F]$.
  8. Pop & Visit F: Push child $K$. Stack: $[G, K]$.
  9. Pop & Visit K: Leaf node at depth 3. Backtrack. Stack: $[G]$.
  10. Pop & Visit G: **Goal node reached! Search halts.**

DFS Visited Order (10 Nodes):
$$\mathbf{A \to B \to D \to H \to E \to I \to C \to F \to K \to G}$$

b) Depth-Limited Search (DLS) with Limit $L = 2$ (10 Marks):
  1. Depth 0: Visit **A**. Push children $C, B$.
  2. Depth 1: Visit **B**. Push children $E, D$.
  3. Depth 2 (Limit Reached): Visit **D**. Because Depth $= L = 2$, child $H$ is **cutoff / pruned**! Backtrack.
  4. Depth 2 (Limit Reached): Visit **E**. Child $I$ is **cutoff / pruned**! Backtrack to $C$.
  5. Depth 1: Visit **C**. Push children $G, F$.
  6. Depth 2 (Limit Reached): Visit **F**. Child $K$ is **cutoff / pruned**! Backtrack to $G$.
  7. Depth 2 (Limit Reached): Visit **G**. **Goal node reached! Search halts successfully.**

DLS Visited Order ($L = 2$, 7 Nodes):
$$\mathbf{A \to B \to D \to E \to C \to F \to G}$$ *(Nodes $H, I, K$ at depth 3 were completely pruned by cutoff).*

c) Comprehensive Comparison Table:
DimensionDepth-First Search (DFS)Depth-Limited Search (DLS, $L=2$)
Nodes Visited10 nodes7 nodes (3 leaf nodes pruned)
Search Efficiency HereWastes time exploring $H, I, K$More efficient; reaches goal faster
Infinite Path TrapVulnerable on infinite treesImmune; strictly bounds depth
Space Complexity$O(bm)$$O(bL)$
Nov 2025 · Question 4.a Hill Climbing Algorithm Principles & 3 Structural Hazards (5 Marks)
Question Statement:
Explain the Hill Climbing algorithm and list its drawbacks. (5 Marks)

Solution:

1. Working Principle:

Hill climbing is an informed local search optimization technique. It inspects immediate neighboring states and moves greedily to whichever state improves the objective function. It terminates when no neighbor is better than the current state. Maintains zero search history ($O(1)$ space).

2. The Three Critical Structural Drawbacks:
  1. Local Maxima: A suboptimal peak higher than all immediate neighbors but lower than the global optimum. Algorithm halts prematurely.
  2. Plateaus & Flat Shoulders: A flat region of identical evaluation values (zero gradient), causing unguided random walks.
  3. Ridges: A sequence of connected local peaks with steep sides and a gentle spine, causing inefficient zig-zag oscillations across the slope.
May 2025 · Question 7.i BFS vs DFS Working Principles & Data Structures (10 Marks)
Question Statement:
Explain working principle of BFS and DFS algorithms with a step-by-step illustration on a sample graph. (10 Marks)

Solution:

1. Breadth-First Search (BFS):
  • Data Structure: First-In, First-Out (**FIFO**) Queue.
  • Principle: Explores all nodes at depth $k$ before examining any node at depth $k+1$.
  • Optimality & Completeness: Guaranteed optimal for uniform edge costs; complete on finite branching. Exponential memory $O(b^d)$.
2. Depth-First Search (DFS):
  • Data Structure: Last-In, First-Out (**LIFO**) Stack.
  • Principle: Descends along a single branch to maximum depth before backtracking.
  • Memory Advantage: Consumes only linear memory $O(bm)$, making it feasible on deep trees where BFS exhausts RAM.

09. Interactive Offline Search Traversal Simulator

Compare DFS vs DLS node visits live on the exam tree structure.

Click button to run search simulation.

10. Active Recall Self-Test Quiz

Answer the questions below to evaluate progress (0/4 answered).
1. In the November 2025 exam tree, why does DLS ($L = 2$) visit only 7 nodes while DFS visits 10 nodes?
Correct: (a) DLS never expands nodes beyond depth $L = 2$. Therefore, leaf nodes $H, I, K$ at depth 3 are completely pruned, saving 3 visits.
2. What data structure is fundamentally used to implement Breadth-First Search (BFS)?
Correct: (b) BFS uses a FIFO (First-In, First-Out) queue to ensure nodes at the current level are explored before descending to the next depth.
3. What is the space complexity of Depth-First Search (DFS)?
Correct: (c) DFS stores only the path from root to current node and sibling nodes along that path, requiring modest linear memory $O(bm)$.
4. How does Simulated Annealing escape local maxima in Hill Climbing?
Correct: (b) When temperature $T$ is high, Simulated Annealing frequently takes downhill moves to jump out of local traps; as $T$ cools, it converges greedily.

11. Exam Hall Answer Sheet Presentation Checklist

1. Label Tree Depths Starting from Depth 0

Write Depth 0 for Root A, Depth 1 for B/C, Depth 2 for D/E/F/G, Depth 3 for H/I/K.

2. Show Stack States Step by Step

Explicitly write stack contents at each step (e.g. $[C, B] \to [C, E, D] \dots$).

3. Explicitly State Pruned Nodes in DLS

Write: "Nodes H, I, K are pruned because their depth 3 > limit L = 2."

4. Provide Side-by-Side Visited Sequences

Box: DFS = $A \to B \to D \to H \to E \to I \to C \to F \to K \to G$ (10 nodes).
Box: DLS = $A \to B \to D \to E \to C \to F \to G$ (7 nodes).

5. For Hill Climbing, Name All 3 Hazards

Draw quick sketches of: (1) Local Maxima, (2) Plateau/Shoulder, (3) Ridge.