Algorithm dossier

  • Category: Crypto
  • Worst-case complexity: O(n)
  • Approach: Iterative
  • Data structure: No DS
  • First formalised: 1880s

Why this snippet is Caesar Cipher

Why Caesar cipher. Shift each letter forward by k positions in the alphabet, wrapping at 'z'. The two branches (lower-case base 97, upper-case base 65) and the % 26 are the dead give-away — there's no key schedule, no S-box, just a constant offset. Why it's broken. Only 25 possible keys; brute force is trivial. Survives as a teaching example and as the basis for ROT-13.

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.