Level 1: Bronze
A memorized definition. Not wrong, but it stops there.
BFS is breadth first and DFS is depth first.
3 stars If you are short on time, start with this one.
In one or two sentences
BFS explores layer by layer from the nearest, using a queue. DFS goes as far as it can along one path and then backtracks, using a stack or recursion.
Say it out loud, or type it below. What you type never leaves this device.
A memorized definition. Not wrong, but it stops there.
BFS is breadth first and DFS is depth first.
Correct, but too broad or missing context.
BFS uses a queue and visits the nearest vertices first, giving shortest distances in an unweighted graph. DFS uses a stack or recursion and follows a path to its end.
Reaches principle, use and trade-off, with words that invite the next question.
Both take time proportional to vertices plus edges. The difference is order and memory. BFS guarantees the fewest edges but must hold a whole layer of vertices in a wide graph. DFS holds one path, so it uses less memory and suits connected components, cycle detection, topological sort and backtracking. Without visited marks it loops forever on a cycle. With weighted edges BFS cannot give shortest distances and you need Dijkstra.
These are likely next questions from an interviewer. Think of your answer first, then press the button.
1 / 3
Why does BFS guarantee a shortest path?
It visits every nearer layer first, so the first path to arrive has the fewest edges. That holds only without weights.
2 / 3
How do you represent a graph?
An adjacency matrix or an adjacency list. With few edges the list is better for space and traversal, and the matrix checks an edge in O(1).
3 / 3
How do you find a cycle?
In an undirected graph, a visited neighbor that is not the parent means a cycle. In a directed graph, meeting a vertex already on the current DFS path means a cycle.
This is a textbook level concept, so no outside source is listed.