BFS vs DFS: when does it actually matter which one you use?
I can implement both, but I get stuck deciding which one a problem wants. My current rule of thumb: - BFS when I care about the fewest edges (shortest path in an unweighted graph), or want to explore "layer by layer." - DFS when I need to fully explore one bra…