Перейти к содержанию

Labs · AI search · BFS, DFS, A*

Search the Maze: BFS, DFS and A*

Build walls, then race four searches from S to E. Watch breadth-first spread like a wave, depth-first dive deep, and A* head straight for the end.

3 levelsFree bench

In the exam

9618/31 May/June 2023 · Question 2(b) · 2 marks

Describe the purpose of both the A* algorithm and Dijkstra's algorithm.

Points that gain marks

  • Both find the best (shortest or cheapest) route between two nodes in a graph.
  • The best route is measured by distance, cost or time on the edges.

In this lab: On the grid every step costs 1, so BFS works like Dijkstra here: it finds a shortest route. A* finds a route just as short but visits fewer squares, because h points it at the end.

More real experiments

Войти или создать аккаунт

IGCSE, A-Level & AP