Collision problem should not be confused with Collision detection problem.
The r-to-1 collision problem is an important theoretical problem in complexity theory, quantum computing, and computational mathematics. The collision problem most often refers to the 2-to-1 version:[1] given
n
f:\{1,\ldots,n\} → \{1,\ldots,n\}
f(i)
i\in\{1,\ldots,n\}
Solving the 2-to-1 version deterministically requires queries, and in general distinguishing r-to-1 functions from 1-to-1 functions requires queries.
This is a straightforward application of the pigeonhole principle: if a function is r-to-1, then after queries we are guaranteed to have found a collision. If a function is 1-to-1, then no collision exists. Thus, queries suffice. If we are unlucky, then the first
n/r
If we allow randomness, the problem is easier. By the birthday paradox, if we choose (distinct) queries at random, then with high probability we find a collision in any fixed 2-to-1 function after
\Theta(\sqrt{n})
The BHT algorithm, which uses Grover's algorithm, solves this problem optimally by only making
O(n1/3)