HW2 Uninformed Search
Use your own paper and show work as much as possible.
1. (5 points) Does a finite state space always lead to a finite search tree? How about a
finite state space that is a tree? Can you be more precise about what types of state
spaces always lead to finite search trees?
2. (15 points) Iterative lengthening search, an iterative analog of uniform cost search.
The idea is to use increasing limits on path cost. If a node is generated whose path
cost exceeds the current limit, it is immediately discarded. For each new iteration, the
limit is set to the lowest path cost of any node discarded in the previous iteration.
a. (5 points) Show that this algorithm is optimal for general path costs.
b. (5 points) Consider a uniform tree with branching factor b, solution depth d,
and unit step costs. How many iterations will iterative lengthening require?
c. (5 points) Now consider step costs drawn from the continuous range [O,l]
with a minimum positive cost E. How many iterations are required in the
worst case?
3. (10 points) Describe a state space in which iterative deepening search performs much
worse than depth-first search (for example, O(n2) vs. O(n)).
4. (40 points) Consider the problem of finding the prime factors of a non-prime number
n. For example, 35=5×7 and 36=2×2×3×3. The brute-force method is to begin
enumerating combinations of primes until you find one whose product equals the
target value. (Note the largest possible prime factor of any number n is at most n/2.)
a. (10 points) Formulate this problem as a search problem (state space, initial
state, successor function, goal test and path cost). Use a pseudocode algorithm
to represent successor function, i.e. action. (Hint: define the action by showing
what children would be generated for any arbitrary state and what state won’t
generate any child). Be sure to state any assumptions.
b. Trace both DFS and BFS in the process of factoring 15. Do not assume that
repeated states are automatically deleted.
i. (6 points) Show the trees generated.
ii. (6 points) Indicate the order in which nodes are goal-tested.
iii. (6 points) How many nodes are generated (answered by
function T, i.e. you must give the exact number)?
iv. (6 points) How many nodes are goal-tested (answered by
function T)?
v. (6 points) How many nodes are expanded (answered by
function T)?
5. (30 points) Suppose you are given a search tree with a uniform branching factor of 3
that is 8 levels deep (including the root node which is on level 1). Suppose there is one
goal node in the tree, and it occurs exactly in the middle of the fifth row (i.e. 4
operators from the start state, taking the middle child each time).
a. (15 points) How many nodes would be expanded by DFS, BFS and iterative
deepening (answered by function T)?
b. (15 points) What is the MAXIMUM queue/stack size for each of these
searches