🤖 AI Summary
This paper addresses the tightness of the classical Ω(n log n) comparison-based lower bound for the element distinctness problem in instances with many duplicates. We introduce the first fine-grained, input-structure-aware competitive analysis framework for this problem. Our approach models duplication patterns via combinatorial graphs and unifies adversarial lower-bound constructions with deterministic competitive algorithm design to establish asymptotically tight lower bounds parameterized by repetition structure. Key contributions are: (1) an O(log log n)-competitive upper and lower bound for element distinctness—significantly improving upon worst-case Ω(n log n) analysis; and (2) a competitive separation between element distinctness and set intersection, establishing a Θ(log n) competitive lower bound for the latter. Collectively, these results shift comparison-model lower-bound analysis from worst-case instance-centric reasoning to structural awareness—a paradigmatic advance in fine-grained complexity.
📝 Abstract
The element distinctness problem takes as input a list $I$ of $n$ values from a totally ordered universe and the goal is to decide whether $I$ contains any duplicates. It is a well-studied problem with a classical worst-case $Omega(n log n)$ comparison-based lower bound by Fredman. At first glance, this lower bound appears to rule out any algorithm more efficient than the naive approach of sorting $I$ and comparing adjacent elements. However, upon closer inspection, the $Omega(n log n)$ bound does not apply if the input has many duplicates. We therefore ask: Are there comparison-based lower bounds for element distinctness that are sensitive to the amount of duplicates in the input? To address this question, we derive instance-specific lower bounds. For any input instance $I$, we represent the combinatorial structure of the duplicates in $I$ by an undirected graph $G(I)$ that connects identical elements. Each such graph $G$ is a union of cliques, and we study algorithms by their worst-case running time over all inputs $I'$ with $G(I') cong G$. We establish an adversarial lower bound showing that, for any deterministic algorithm $mathcal{A}$, there exists a graph $G$ and an algorithm $mathcal{A}'$ that, for all inputs $I$ with $G(I) cong G$, is a factor $O(log log n)$ faster than $mathcal{A}$. Consequently, no deterministic algorithm can be $o(log log n)$-competitive for all graphs $G$. We complement this with an $O(log log n)$-competitive deterministic algorithm, thereby obtaining tight bounds for element distinctness that go beyond classical worst-case analysis. We subsequently study the related problem of set intersection. We show that no deterministic set intersection algorithm can be $o(log n)$-competitive, and provide an $O(log n)$-competitive deterministic algorithm. This shows a separation between element distinctness and the set intersection problem.