College of Computer and Information Sciences
Information Technology Department
IT327
Artificial Intelligence
Homework 2 search strategies
Q1.
A. Show that DFS generates about O(bm) nodes in the search tree. m: The maximum length of any path in the state space b: The branching factor: maximum number of successors of any node.
At the worst case, DFS generates about O(bm) nodes in the search tree. As follows :
At m (max depth )tries : 1 +b + b2 + b3 +….+ bm =O(bm) , the graph below illustrates this.
B. Explain why DFS requires less memory than BFS.
In BFS you keep all nodes in memory, so the complexity is O(b^[d+1]) which is the number of generated nodes (or O(b^[d+1])). In BFS time complexity = memory complexity.
For DFS you only keep the path to the current node in memory and potentially all its the successors of those nodes, so its O(bm).
Where : b: The branching factor: maximum number of successors of any node. d: The depth of the shallowest goal node. m: The maximum length of any path in the state space.
Q2.
A. Starting from “a”, find the goal “e” using DFS with tree-search algorithm, and then with graph-search algorithm.
You have to show:
1. The search tree.
2. The order in which nodes will be visited.
3. The fringe at each step.
4. The closed set (in case of graph-search only).
5. The solution path.
6. The fringe (and closed set) after the search is terminated.
Note: expand nodes in alphabetical order when you have more than one candidate for expansion.
Using Graph search algorithm:
Order of node visited : a , b, a, c, a, b, e.
Closed List: a , b, c.
Solution Path : a , b , c, e.
Final fringe : c, d.
Using Tree search algorithm:
Order of node visited : a0 , b1, a2, b3, a4, b5, …….
Note : ni means : n is a node, and i is depth of node n.
Result: infinite tree, the goal will not be reached, because we cannot rid from repeated states.
Final fringe : infinite