July 2015
Intermediate to advanced
286 pages
6h 31m
English
Prim’s algorithm was first developed in 1930 by a Czech mathematician named Vojtěch Jarník, but it gets its name from Robert C. Prim, a computer scientist who rediscovered it independently in 1957. It works similarly to Dijkstra’s algorithm, starting at one point in the grid and then moving outward like water flowing, but in Prim’s case it does more than just measure distances and costs. The end result of Prim’s is one of those fancy minimum spanning trees—or, in our case, a maze.
As with Kruskal’s algorithm, Prim’s works by considering the weights on the connections between cells—passage costs—rather than on the individual cells themselves. We’ll look at how this comes together, but then we’ll take a step back ...