↓ Skip to main content

“It may look like it is obviously wrong, but we prove that it is in fact correct.”

Stanley P. Y. Fungarxiv.org ↗

Two nested loops over the whole array, swap when the comparison looks backwards, done. Every code reviewer alive would flag it as a bug. It sorts anyway. Nobody should ship it. The real lesson is how badly experienced programmers read code they think they already understand.