Glossary: Data Structures and Algorithms in Java
BFS (breadth-first search)
Also written: breadth-first search, BFS
A graph search that visits the start, then its neighbors, then their neighbors, ring by ring, using a queue and a visited set. It finds the route with the fewest stops.
Where the book teaches it
Related terms
queuevisited setcameFromDFS (depth-first search)Big-O shapes (O(1), O(log n), O(n), O(n log n), O(n²), O(V + E))