Unit 1 Part 2

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 3

DFS - Depth First Search

Depth-first search (DFS) is an algorithm for searching a


graph or tree data structure. The algorithm starts at the
root (top) node of a tree and goes as far as it can down a
given branch (path), then backtracks until it finds an
unexplored path, and then explores it. The algorithm
does this until the entire graph has been explored.
Algorithm
If the initial state is a goal state, quit and return success.
Otherwise,do the following untill success or failure is
signaled :
Generate a successor, E, of the initial state. If there are
no more successors, signal failure.
Call Depth-First Search with E as the initial state.
If success is returned, signal success. Otherwise continue
in this loop.
Advantages Of DFS :-
1. Memory requirement is Linear WRT Nodes.
2. Less time and space complexity rather than BFS.
3. Solution can be found out by without much more
search.

Disadvantage of DFS :-
1. Not Guaranteed that it will give you solution.
2. Cut-off depth is smaller so time complexity is
more.
3. Determination of depth until the search has
proceeds.

PROBLEM CHARACTERISTICS
A problem may have different aspects of
representation and explanation. In order to choose the
most appropriate method for a particular problem, it is
necessary to analyze the problem along several key
dimensions. Some of the main key features of a problem
are given below :
 Is the problem decomposable into set of sub
problems?
 Can the solution step be ignored or undone?
 Is the problem universally predictable?
 Is a good solution to the problem obvious without
comparison to all the possible solutions?
 Is the desire solution a state of world or a path to a
state?
 Is a large amount of knowledge absolutely required
to solve the problem?
 Will the solution of the problem required interaction
between the computer and the person?
The above characteristics of a problem are called as
7-problem characteristics under which the solution must
take place.

You might also like