BFS
|
DFS
|
(i) BFS is vertex
based algorithm.
|
(i) DFS is an edge
based algorithm.
|
(ii) BFS is optimal
algorithm.
|
(ii) DFS is not
optimal algorithm.
|
(iii) Queue data
structure is used in BFS.
|
(iii) DFS uses stack or
recursion.
|
(iv) Memory space is
not efficiently utilized in BFS.
|
(iv) Memory space is
efficiently utilized in DFS.
|
(v) BFS constructs
wide and short tree.
|
(v) DFS constructs
narrow and long trees.
|
(vi) BFS is slower and
require more memory.
|
(vi) DFS is faster and
require less memory.
|
(vii) BFS visit nodes
level by level in Graph.
|
(vii) DFS visit nodes
of graph depth wide. It visits nodes until reach doesn’t reach a leaf or node
which doesn’t have non-visited nodes.
|
(viii) Some applications:
|
(viii) Some application:
|
10 March 2018
Differentiate between BFS and DFS
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment