Challenge 1: Implement Breadth First Graph Traversal
Implement Breadth First Graph Traversal.
We'll cover the following
Problem Statement
You have to implement the Breadth-First Traversal in C++.
To solve this problem, all the previously implemented data structures will be available to us.
Input
A graph represented as an adjacency list and a starting vertex.
Output
A string containing the vertices of the graph listed in the correct order of traversal.
Sample Input
Graph:
graph = {0 -> 1
1 -> 2
1 -> 3
2 -> 4
3 -> 4
3 -> 5}
Sample Output
"0 1 2 3 4 5";
Print Left Child first and then Right Child!
Create a free account to view this lesson.
By signing up, you agree to Educative's Terms of Service and Privacy Policy