150 likes | 165 Views
This is a visual representation of a maze running algorithm implemented in C programming language. The algorithm uses the Best-First search method with a priority queue implemented as a heap. The maze is explored by taking nodes in the order of UP, LEFT, DOWN, RIGHT. The algorithm marks visited nodes as yellow and finds the shortest path from the green start node to the red exit node.
E N D
Maze Running in C Minor A Series of Slides in 5 Parts Movement 4. Best-First
AT: AA HEAP: AB – 5 Nodes are taken in the order: UP, LEFT, DOWN, RIGHT The heap is emptied in a FIFO order when it comes to duplicates. KEY: GREEN – Start RED – Exit YELLOW – Visited
AT: AB HEAP: CA – 4 BB – 4 Since we know that keeping track of where we’ve visited makes for a more efficient search, we’ll only insert nodes we’ve not visited into the heap. Nodes are taken in the order: UP, LEFT, DOWN, RIGHT The heap is emptied in a FIFO order when it comes to duplicates. KEY: GREEN – Start RED – Exit YELLOW – Visited
AT: CA HEAP: BB – 4 Nodes are taken in the order: UP, LEFT, DOWN, RIGHT The heap is emptied in a FIFO order when it comes to duplicates. KEY: GREEN – Start RED – Exit YELLOW – Visited
AT: BB HEAP: BA – 5 CB – 3 Nodes are taken in the order: UP, LEFT, DOWN, RIGHT The heap is emptied in a FIFO order when it comes to duplicates. KEY: GREEN – Start RED – Exit YELLOW – Visited
AT: CB HEAP: BA – 5 DB – 2 Nodes are taken in the order: UP, LEFT, DOWN, RIGHT The heap is emptied in a FIFO order when it comes to duplicates. KEY: GREEN – Start RED – Exit YELLOW – Visited
AT: DB HEAP: BA – 5 DA – 3 DC – 1 EB – 3 Nodes are taken in the order: UP, LEFT, DOWN, RIGHT The heap is emptied in a FIFO order when it comes to duplicates. KEY: GREEN – Start RED – Exit YELLOW – Visited
AT: DC HEAP: BA – 5 DA – 3 EB – 3 CC – 2 Nodes are taken in the order: UP, LEFT, DOWN, RIGHT The heap is emptied in a FIFO order when it comes to duplicates. KEY: GREEN – Start RED – Exit YELLOW – Visited
AT: CC HEAP: BA – 5 DA – 3 EB – 3 BC – 3 CD – 1 Nodes are taken in the order: UP, LEFT, DOWN, RIGHT The heap is emptied in a FIFO order when it comes to duplicates. KEY: GREEN – Start RED – Exit YELLOW – Visited
AT: CD HEAP: BA – 5 DA – 3 EB – 3 BC – 3 Nodes are taken in the order: UP, LEFT, DOWN, RIGHT The heap is emptied in a FIFO order when it comes to duplicates. KEY: GREEN – Start RED – Exit YELLOW – Visited
AT: DA HEAP: BA – 5 EB – 3 BC – 3 CA – 4 Nodes are taken in the order: UP, LEFT, DOWN, RIGHT The heap is emptied in a FIFO order when it comes to duplicates. KEY: GREEN – Start RED – Exit YELLOW – Visited
AT: EB HEAP: BA – 5 BC – 3 CA – 4 EA – 4 EC – 2 Nodes are taken in the order: UP, LEFT, DOWN, RIGHT The heap is emptied in a FIFO order when it comes to duplicates. KEY: GREEN – Start RED – Exit YELLOW – Visited
AT: EC HEAP: BA – 5 BC – 3 CA – 4 EA – 4 ED – 1 Nodes are taken in the order: UP, LEFT, DOWN, RIGHT The heap is emptied in a FIFO order when it comes to duplicates. KEY: GREEN – Start RED – Exit YELLOW – Visited
AT: ED HEAP: BA – 5 BC – 3 CA – 4 EA – 4 DD – 0 Nodes are taken in the order: UP, LEFT, DOWN, RIGHT The heap is emptied in a FIFO order when it comes to duplicates. KEY: GREEN – Start RED – Exit YELLOW – Visited
AT: DD HEAP: BA – 5 BC – 3 CA – 4 EA – 4 Nodes are taken in the order: UP, LEFT, DOWN, RIGHT The heap is emptied in a FIFO order when it comes to duplicates. KEY: GREEN – Start RED – Exit YELLOW – Visited