HN Hall of Fame Weekly email

Damn Cool Algorithms: Levenshtein Automata

blog.notdot.net Books & learning Tutorials & guides Computer science Candidate
Screenshot of blog.notdot.net captured 2026-07-20
Page preview · captured 2026-07-20

Resurfaced independently across 5 calendar years, with breakout response in 3 of them.

submissions
6
submitters
5
observed span
2010–2022
peak thread · 34 comments
208 pts
latest 20+ return · 2022-03-05
208 pts

Submission timeline

2007–2026

One slot for every year since HN launched. Height is that year's peak points; orange marks a 100+ point or 50+ comment breakout. Select a bar to open its strongest thread.

First comments on top threads

HN comment order

Not sure why the Myers bit vector algorithm from 1999 is not included in these comparisons. Since it can operate on whole 32-bit or 64-bit registers at a time, it is really O(NM/w) which is in effect just O(N) and just gives you the whole edit distance. Heikki Hyyrö has a few papers and a PhD thesis from circa 2001..2005 that walk you through this in pseudo-code that you could port to any low level language and also generalize the…

cb321·208-point thread·

https://github.com/intel/hyperscan/ implements this along multiple regex matching and a pcre pattern compatible engine (chimera).

mgliwka·172-point thread·

Actually, if you want to see whether the edit distance (Levenshtein) is within a fixed bound, say k, it's no longer O(mn), but around O(kn) (since you're only ever filling a narrow band of width ~k along the diagonal instead of the whole rectangle). Nonetheless, the DFA construction is priceless if you want flexible matching against a dictionary.

sqrt17·118-point thread·

For those of you like me who tried to read this article without the proper education to understand everything at first pass, here is the definition of a couple of acronyms he used without defining first: NFA = Nondeterministic Finite Automata (http://en.wikipedia.org/wiki/Nondeterministic_finite-state_m...) DFA = Deterministic Finite Automata (http://en.wikipedia.org/wiki/Deterministic_finite-state_mach...)

The first top-level comment from each of the four biggest threads, in HN’s own order. Excerpts are shortened; open a comment for full context.

Breakout years
3

100+ points or 50+ comments

Total points
659

reference only — not used in Hall rules or ranking

Total comments
84

reference only — not used in Hall rules or ranking

Every submission

DateTitle as submittedByPointsComments
2010-07-28Damn Cool Algorithms: Levenshtein AutomataFirst breakoutdesigooner11814
2011-03-17Damn Cool Algorithms: Levenshtein Automatambowcock998
2015-06-10Levenshtein Automata (2010)beau6134
2018-08-30Levenshtein Automata (2010)tosh10
2018-09-04Levenshtein Automata (2010)tosh17211
2022-03-05Damn Cool Algorithms: Levenshtein AutomataBest thread · Latest 20+ point returngraderjs20817