Breadth-First Traversal Order

Graphs ยท easy

Given an adjacency list `adj` (where `adj[i]` lists neighbors of node `i`) and a `start` node, implement `bfs(adj, start)` returning the order nodes are visited by breadth-first search. Visit neighbors in listed order.

Learning resources

Loading...

Run your code to see results.