Explanation: DFS requires node to be expanded the one most recent visited, hence stack is convenient to implement. 6. The time and space complexity of BFS is (For time and space complexity problems consider b as branching factor and d as depth of the search tree.)
A. O(bd+1) and O(bd+1)
B. O(b2) and O(d2)
C. O(d2) and O(b2)
D. O(d2) and O(d2)
Answer:A
Explanation: DFS requires node to be expanded the one most recent visited, hence stack is convenient to implement. 6. The time and space complexity of BFS is (For time and space complexity problems consider b as branching factor and d as depth of the search tree.)
A. O(bd+1) and O(bd+1) B. O(b2) and O(d2) C. O(d2) and O(b2) D. O(d2) and O(d2)
Explanation: We consider a hypothetical state space where every state has b successors. The root of the search tree generates b nodes at the first level, each of which generates b more nodes, for a total of b2 at the second level. Each of these generates b more nodes, yielding b3 nodes at the third level, and so on. Now suppose that the solution is at depth d. In the worst case, we would expand all but the last node at level d (since the goal itself is not expanded), generating bd+1- b nodes at level d+1 7. Breadth-first search is not optimal when all step costs are equal, because it always expands the shallowest unexpanded node. State whether true or false.