BFS algorithms by R4R Team

BFS:
-Stands for the Breadth First Search
-It is used to Traverse a graph in a breadthward motion and uses a queue to remember to get the next vertex to start a search, when a dead end occurs in any iteration.

Which data structure use to implement BFS ?
"Queue" is used to implement this.

Steps:

Step1:
Visit the adjacent unvisited vertex. Mark it as visited. Display it. Insert it in a queue.

Step2:
If no adjacent vertex is found, remove the first vertex from the queue.

Step3:
Repeat step1 and step2 until the queue is empty.




Leave a Comment:
Search
Categories
R4R Team
R4Rin Top Tutorials are Core Java,Hibernate ,Spring,Sturts.The content on R4R.in website is done by expert team not only with the help of books but along with the strong professional knowledge in all context like coding,designing, marketing,etc!