Algorithm dossier
- Category: Shortest path
- Worst-case complexity: O(n²)
- Approach: Greedy
- Data structure: Graph
- First formalised: 1950s
Why this snippet is Dijkstra's Algorithm
Why Dijkstra. Greedy single-source shortest path with *non-negative* edge weights. Each outer step picks the unfinalised vertex with the smallest tentative cost f[i] and relaxes its out-edges. Implementation note. This is the O(V²) dense-graph variant — pick-min by linear scan. The textbook heap variant is O((V+E) log V), faster on sparse graphs, but the *algorithm* is the greedy-relaxation pattern either way.
How to read a redacted algorithm
Algodle strips identifier names so the snippet has to be read for its shape: the control flow, the data structures it manipulates, the order in which it visits its input. Loops with two pointers crawling toward each other are usually search or partition. A recursion that splits its input in half and recurses on both halves is divide-and-conquer. A priority queue plus graph traversal is almost certainly Dijkstra, Prim, or A*. Six hint columns — category, complexity, approach, data structure, era — let you triangulate even when the snippet itself is opaque.