I&#x27;d be OK with using BFS or DFS, but with this caveat:<p>If it&#x27;s a whiteboard thing, then don&#x27;t expect a detailed, working implementation in code.  Ask for a sketch &#x2F; high level overview &#x2F; pseudo-code that shows the candidate understand it well enough that you can infer that they could implement it with a compiler &#x2F; google &#x2F; book &#x2F; etc.<p>OR<p>If you want an implementation, give them a machine, let them use their language of choice, use google, etc.,  and let them actually code it up, making and fixing errors as they go, etc.  I actually like this because it lets you see how someone approaches debugging, etc.<p>In either case, you could supplement the exercise with some discussion questions &quot;why &#x2F;when would you use BFS?&quot; etc.