Tight Better-Than-Worst-Case Bounds for Element Distinctness and Set Intersection
Abstract
The element distinctness problem takes as input a list of values from a totally ordered universe and the goal is to decide whether contains any duplicates. It is a well-studied problem with a classical worst-case 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 and comparing adjacent elements. However, upon closer inspection, the 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 , we represent the combinatorial structure of the duplicates in by an undirected graph that connects identical elements. Each such graph is a union of cliques, and we study algorithms by their worst-case running time over all inputs with . We establish an adversarial lower bound showing that, for any deterministic algorithm , there exists a graph and an algorithm that, for all inputs with , is a factor faster than . Consequently, no deterministic algorithm can be -competitive for all graphs . We complement this with an -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 -competitive, and provide an -competitive deterministic algorithm. This shows a separation between element distinctness and the set intersection problem.
Cite
@article{arxiv.2511.02954,
title = {Tight Better-Than-Worst-Case Bounds for Element Distinctness and Set Intersection},
author = {Ivor van der Hoog and Eva Rotenberg and Daniel Rutschmann},
journal= {arXiv preprint arXiv:2511.02954},
year = {2025}
}