CS Electrical And Electronics
@cselectricalandelectronics

Explain DFS and BFS with examples

All QuestionsCategory: Data StructureExplain DFS and BFS with examples
CS Electrical And Electronics Staff asked 3 years ago

I need short information.

1 Answers
CS Electrical And Electronics Staff answered 3 years ago

Depth-first search (DFS) is an algorithm for crossing or searching tree or graph data structures. The algorithm begins at the root node (selecting some random node as the root node in the case of a graph) and travels as far as possible along each branch before backtracking.
 
Breadth-first search (BFS) is an essential graph search algorithm that is employed to solve many problems including finding the shortest path in a graph and solving puzzle games (such as Rubik’s Cubes). Many problems in computer science can be conceived of in terms of graphs.