Amazon Interview Question

Graph problem: I write out the pseudo-code for solution by interation not recursion, but the interviewer spent a lot of time to understand it. Maybe my fault. Maybe he expected the recursion solution.