We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent c30f696 commit 0abf46bCopy full SHA for 0abf46b
Main.java
@@ -33,11 +33,11 @@ public static void BFS(String src){ // BREADTH-FIRST-SEARCH
33
if(adj.isEmpty()) return;
34
35
HashSet<String> set=new HashSet<>();
36
- Queue<String> q=new LinkedList<>();
+ Queue<String> q=new LinkedList<>(); //BFS uses Queue data structure
37
q.offer(src);
38
set.add(src);
39
40
- while(!q.isEmpty()){
+ while(!q.isEmpty()){
41
String node=q.poll();
42
System.out.print(node+" ");
43
List<Node> neighbours=adj.get(src);
0 commit comments