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 an A* search - Python Tutorial
From the course: Python Data Structures and Algorithms
Solution: Trace the path of an A* search
(upbeat music) - [Instructor] And here's a solution for the A-star challenge. So the path produced is zero zero zero one one one one two two two three two three three. Now note, this is the same path as for BFS. And I may have given away that information a little bit too early and you might have known that already and just looked to your previous answer. But the idea of this challenge is of course to work through the algorithm so I hope you did do that. This the same because both BFS and A-star guarantee a shortest path and that's with certain conditions on the heuristic that's used. But generally speaking, it's going to be the shortest path for both. The difference is that A-star gets there with far fewer steps. It's a much better or more efficient algorithm. Now, as an additional exercise, if you'd like you can check this result by going into your project, going into mazes. You'll see, we have the challenge maze there. That's exactly the same maze as on the challenge slide. And you…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.