Skip to content
Advertisement

Is there an ELI5 explanation on Prim’s algorithm for generating maze in Java?

I am trying to implement a randomly generated maze using Prim’s algorithm in Java.

However, after reading up on Wikipedia and other answers, there’s minimal explanation on how the implementation I found actually works.

For example:

JavaScript

What is a simple explanation for what the LinkedList is doing?

Advertisement

Answer

It’s the queue that backs a BFS (Breadth First Search) algorithm.

See A* Search Algorithm for a generally applicable and interesting BFS use case.

User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement