Adversary Arguments
Symptom You need the largest and second-largest element of an array. The obvious way is two passes: $n-1$ comparisons for the max, then $n-2$ for the max of the rest. That is $2n - 3$. ...
Symptom You need the largest and second-largest element of an array. The obvious way is two passes: $n-1$ comparisons for the max, then $n-2$ for the max of the rest. That is $2n - 3$. ...
Symptom Every general-purpose sort in every standard library is $O(n \log n)$. Timsort, introsort, pdqsort, merge sort, heapsort. Decades of work by extremely motivated people, an enormous amount of money riding on it, and they all land on the same exponent. ...
Symptom Someone sends you a pitch deck. The claim is a compression algorithm that reduces any file by a guaranteed ratio, and — this is always the tell — that it can be applied repeatedly. Four gigabytes down to one, then one down to two fifty, and so on until the whole film is a few hundred bytes and a clever decoder. ...
Symptom You are asked to build a cache key. You have a 64-bit hash, and someone on the team says: “collisions are basically impossible, there are eighteen quintillion values.” Or: your service assigns short IDs to uploads, six characters of base-36, and you are wondering when you need to worry. ...