3. Search Algorithms
• Do faster computers help? If searching takes too
long, the obvious solution would appear to be to
get a faster computer (or many parallel
computers).
• Irrelevant Operators: Irrelevant operators
increase the branching factor b, and this rapidly
increases the size of the search space, bd.
• Search Order: The excessive time spent in
searching is almost entirely spent on failures.
4. Search Algorithms
Uninformed Search
• Search without
information
• No knowledge
• Time consuming
• More complexity (time,
space)
• DFS, BFS, etc.
Informed Search
• Search with information
• Use knowledge to find
steps
• Quick solution
• Less complexity (time,
space)
• A*, Best First Search, etc.
7. Breadth-first search (BFS)
• Uninformed
• FIFO (Queue data
structure)
• Shallowest node
• Complete
• Optimal
• Time Complexity
– O(V+E)
– O(bd)
A
F
D
C
E
B
G
N
J
H I
M
K L
0
2
1
4
3
8. Breadth-first search
Advantage:
1. Guaranteed to find an optimal solution (in terms
of shortest number of steps to reach the goal).
2. Can always find a goal node if one exists
(complete).
Disadvantage:
1. High storage requirement: exponential with tree
depth.
9. Depth-first search (DFS)
• Uninformed
• LIFO (Stack data
structure)
• Deepest node
• Incomplete
• Non-optimal
• Time Complexity
– O(V+E)
– O(bd)
A
F
D
C
E
B
G
N
J
H I
M
K L
0
2
1
4
3
10. Depth-first search
Advantage:
1. Low storage requirement: linear with tree depth.
2. Easily programmed: function call stack does most
of the work of maintaining state of the search.
Disadvantage:
1. May find a sub-optimal solution (one that is
deeper or more costly than the best solution).
2. Incomplete: without a depth bound, may not find
a solution even if one exists.
11. Bounded depth-first search
Problems:
1. It’s hard to guess how deep the solution lies.
2. If the estimated depth is too deep (even by 1) the
computer time used is dramatically increased, by
a factor of bextra.
3. If the estimated depth is too shallow, the search
fails to find a solution; all that computer time is
wasted.
13. Cost first search
Note visited:
A, C, B, D, G, E, L,
I, K, H, F, J, M, N
A
F
D
C
E
B
G
N
J
H I
M
K L
4
6
3
4
3
4
3
2
7
2
3
6
1
Child B C D G H E F I L J K M N
Cost 4 3 7 7 10 7 10 9 8 11 9 12 12