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
Model answer
What a good answer should say
- Follow one available route as far as possible, then backtrack when necessary
Explanation
Why this works
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.
Common mistake
No common mistake is linked to this question yet.
