Ai-Home Assignment

Only available on StudyMode
  • Topic: Breadth-first search, Depth-first search, Search algorithms
  • Pages : 7 (2072 words )
  • Download(s) : 59
  • Published : May 1, 2013
Open Document
Text Preview
1. Define BFS(Breadth First Search).
Answer: Breadth First Search (BFS) searches breadth-wise in the problem space. Breadth-First search is like traversing a tree where each node is a state which may a be a potential candidate for solution. Breadth first search expands nodes from the root of the tree and then generates one level of the tree at a time until a solution is found.

2. Advantages of BFS.
Answer: Breadth first search will never get trapped exploring the useless path forever. If there is a solution, BFS will definitely find it out.
If there is more than one solution then BFS can find the minimal one that requires less number of steps. 3. Disadvantages of BFS.
Answer: The main drawback of Breadth first search is its memory requirement. Since each level of the tree must be saved in order to generate the next level, and the amount of memory is proportional to the number of nodes stored, the space complexity of BFS is O(bd). As a result, BFS is severely space-bound in practice so will exhaust the memory available on typical computers in a matter of minutes.

If the solution is farther away from the root, breath first search will consume lot of time. 4. Define DFS(Depth First Search).
Answer: Depth First Search (DFS) searches deeper into the problem space. More commonly, depth-first search is implemented recursively, with the recursion stack taking the place of an explicit node stack. 5. Advantages of DFS.

Answer: 1. The advantage of depth-first Search is that memory requirement is only linear with respect to the search graph. This is in contrast with breadth-first search which requires more space. The reason is that the algorithm only needs to store a stack of nodes on the path from the root to the current node. 2.The time complexity of a depth-first Search to depth d is O(b^d) since it generates the same set of nodes as breadth-first search, but simply in a different order. Thus practically depth-first search is time-limited rather than space-limited. 3.If depth-first search finds solution without exploring much in a path then the time and space it takes will be very less. 6. Disadvantages of DFS.

Answer: 1.The disadvantage of Depth-First Search is that there is a possibility that it may go down the left-most path forever. Even a finite graph can generate an infinite tree. One solution to this problem is to impose a cutoff depth on the search. Although the ideal cutoff is the solution depth d and this value is rarely known in advance of actually solving the problem. If the chosen cutoff depth is less than d, the algorithm will fail to find a solution, whereas if the cutoff depth is greater than d, a large price is paid in execution time, and the first solution found may not be an optimal one. 2. Depth-First Search is not guaranteed to find the solution. 3. And there is no guarantee to find a minimal solution, if more than one solution exists. 7. Main strategy of BFS and DFS.

Answer: Breadth-first search always generates successor of the deepest unexpanded node. Depth First Search uses last-in first-out stack for keeping the unexpanded nodes. 8. Complexity of finding optimal solutions with Heuristic Search. Answer: The time complexity of a heuristic search algorithm depends on the accuracy of the heuristic function. For example, if the heuristic evaluation function is an exact estimator, then A* search algorithm runs in linear time, expanding only those nodes on an optimal solution path. Conversely, with a heuristic that returns zero everywhere, A* algorithm becomes uniform-cost search, which has exponential complexity.

In general, the time complexity of A* search and IDA* search is an exponential function of the error in the heuristic function. For example, if the heuristic has constant absolute error, meaning that it never underestimates by more than a constant amount regardless of the magnitude of the estimate, then the running time of A* is linear with respect to the...
tracking img