Skip to main content

BFS

Learn BFS (Graphs, Advanced DSA) with worked examples, diagrams and interview questions. Free on JavaSchoolLab.

Traversing a Graph BFS (Breadth-First Search) - explores level by level using a Queue; finds the SHORTEST path in an unweighted graph. DFS (Depth-First Search) - explores as deep as possible along one branch before backtracking, using a Stack (or recursion).

More lessons in Graphs