Quiz 2

🌐 State Space Search & Blind Search

364 words
2 min read
Python Week 1: the first filter for runtime behavior
Visual companion
Python
Type and operator map

Python Week 1: the first filter for runtime behavior

View
Revision summary

What this note is really saying

Short form

# 🌐 State Space Search & Blind Search ## 1. 🎯 Learning Objectives - Define state space: states, operators, MoveGen, GoalTest - Trace DFS and BFS with full OPEN/CLOSED tables - Compare DFS (linear space) vs BFS (exponential space) - Explain when to use CLOSED list vs tree search ## 2.

🌐 State Space Search & Blind Search

1. 🎯 Learning Objectives

  • Define state space: states, operators, MoveGen, GoalTest
  • Trace DFS and BFS with full OPEN/CLOSED tables
  • Compare DFS (linear space) vs BFS (exponential space)
  • Explain when to use CLOSED list vs tree search

2. 📖 Core Content

3.1 State Space Definition

A state space is a 5-tuple (S, s₀, A, T, G):
  • S: Set of all states
  • s₀: Initial state
  • A: Actions/operators
  • T: Transition function S × A → S
  • G: Goal states MoveGen(s): Returns successors of state s. GoalTest(s): Returns True if s is a goal state.

3.2 OPEN and CLOSED Lists

ListPurposeData Structure
OPENStates generated but not expandedDFS: Stack, BFS: Queue
CLOSEDStates already expandedHash set

3.3 DFS Trace Example

Graph: A→B, A→C, B→D, B→E, C→F, C→G. Goal = F.
StepOPEN (stack, top=right)CLOSEDCurrentNotes
0[A]{}-Start
1[C, B]{A}APop A. Push C then B
2[C, E, D]{A, B}BPop B. Push E then D
3[C, E]{A, B, D}DPop D. No successors (dead end)
4[C]{A, B, D, E}EPop E. No successors
5[G, F]{A, B, D, E, C}CPop C. Push G then F
6[G]{A, B, D, E, C, F}FGoal found!
Path: A-C-F. Nodes inspected: A, B, D, E, C, F.

3.4 BFS Trace (Same Graph)

StepOPEN (queue, back=right)CLOSEDCurrentNotes
0[A]{}-Start
1[B, C]{A}ADequeue A. Enqueue B, C
2[C, D, E]{A, B}BDequeue B. Enqueue D, E
3[D, E, F, G]{A, B, C}CDequeue C. Enqueue F, G
4[E, F, G]{A, B, C, D}DDequeue D. Dead end
5[F, G]{A, B, C, D, E}EDequeue E. Dead end
6[G]{A, B, C, D, E, F}FGoal found!
Path: A-C-F (shortest path, also found by DFS in this case).

3.5 Key Differences

PropertyDFSBFS
OPEN structureStack (LIFO)Queue (FIFO)
SpaceO(bd)O(b^d)
Optimal?NoYes
Complete?With CLOSEDYes

4. 📝 Practice Questions

Q1: Trace DFS on graph A→B, A→C, B→D, C→D with goal = D, alphabetical ordering.
Answer: OPEN=[A]. Pop A → [C,B]. Pop B → [C,D]. Pop D → Goal! Path: A-B-D. Nodes: A, B, D. Q2: For the same graph, trace BFS.
Answer: OPEN=[A]. Dequeue A → [B,C]. Dequeue B → [C,D]. Dequeue C → [D,D2]. Dequeue D → Goal! Path: A-C-D. BFS finds shortest path (2 edges) vs DFS (2 edges, same here). Join Discord PreviousAI PhilosophyNextConfig vs Planning
Document outline

Keep your place and jump directly to a heading.

Table of Contents
System Normal // Awaiting Context

Intelligence Hub

Navigate the knowledge graph to generate context. The Hub adapts dynamically to surface backlinks, related notes, and metadata insights.