Share your repls and programming experiences

← Back to all posts
Dijkstra's algorithm one liner! (1 line series)[no6]
rafrafraf (1396)

the one line master is back ;)

This time i made dijkstra's algorithm in one line, it took me around 2 hours to make and uhm yeah it was hard lmao

As usual, no semi colons, true one liner.

CookieSnowOwl (41)

upvoted wow amazing
2. it's so funny when u enter g the error message is SOOO LONG

Th3Coder (95)


I am simply astonished by this.

Also, no semicolons? That's new, but really cool!

Also, if I may ask, what is unvisited? Thanks!

MarcusWeinberger (774)

@Th3Coder that contains all the nodes yet to be visited

Th3Coder (95)

@MarcusWeinberger so does that mean all nodes that haven't been accessed yet?

Anyways, thanks!

MarcusWeinberger (774)

@Th3Coder yep, dijkstra's algorithm works by checking the distance to all unvisited nodes. and no problem!

BananaJellyfish (207)

Wow, one line! This is really cool!

MarcusWeinberger (774)

Bruh you gotta print the route as well come on

MarcusWeinberger (774)

Damnnn it took me longer than that just to make it normally

ch1ck3n (1632)

7 7 7 7 7 7 7 7 7 7 7 7 7 how