From the course: Python Data Structures and Algorithms

Unlock the full course today

Join today to access over 24,800 courses taught by industry experts.

Solution: Trace the path of a breadth-first search

Solution: Trace the path of a breadth-first search - Python Tutorial

From the course: Python Data Structures and Algorithms

Solution: Trace the path of a breadth-first search

(upbeat music) - [Instructor] Here's a solution to the BFS challenge then. So this is the path the algorithm produces for the given maze, assuming you used exactly the same implementation that we have been using so far. And that includes the order on which we own QR elements. So we go up, right, down, left. So the path you should have got is (0,0), (0,1), (1,1) (1,2), (2,2), (3,2), (3,3), as shown on the slide. If you got a different answer, then go back and see what you did differently and see if when you apply the algorithm correctly, you get the same result as I did.

Contents