Exam-style question
Try this first
Which description best matches depth-first search when navigating a maze?.
- A.Visit every neighbouring junction at the current distance before moving farther away
- B.Follow one available route as far as possible, then backtrack when necessary
- C.Choose a route with the greatest number of edges
- D.Visit only the starting junction
Answer and explanation
Concise answer
Follow one available route as far as possible, then backtrack when necessary
Why this is correct
Depth-first search explores deeply along one branch before returning to an earlier junction to try another branch. This makes it suitable for navigating a maze.
Use the concise answer above for a quick check, then reveal the full model answer and detailed explanation.
Common mistake
No common mistake is linked to this question yet.
