What is the difference between a depth first and a breadth f

  What is the difference between a depth first and a breadth first search? What do they correspond to if the graph in question is a binary tree? They can be implemented almost identically by changing one data structure in the implementation. What data structure?  

Solution

In depth first search we recursively traverse\\solve for children from parent rather than for sibling.

where as in breadth first search we traverse\\solve for siblings rather than for childrens for the current node.

Level order traversal is the name of traversal while doing traversal level by level in binary tree.

For depth first search we have inorder traversal which traverses root first and then its childrens.

For breadth first search we use Queue data structure where as for depth first search we use Stack as a data structure.

 What is the difference between a depth first and a breadth first search? What do they correspond to if the graph in question is a binary tree? They can be impl

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site