This paper establishes the exact comparison complexity of finding an element repeated $n$ times in a $2n$-element array containing $n+1$ distinct values, under the equality-comparison model with $O(1)$ extra space. We present a simple deterministic algorithm performing exactly $n+2$ comparisons and prove this bound tight: any correct algorithm requires at least $n+2$ comparisons in the worst case. The lower bound follows from an adversary argument using graph-theoretic structure. Equality queries build an inequality graph $I$; its complement $P$ (potential-equalities) must contain either two disjoint $n$-cliques or one $(n+1)$-clique to maintain ambiguity. We show these structures persist up through $n+1$ comparisons via a "pillar matching" construction and edge-flip reconfiguration, but fail at $n+2$. This result provides a concrete, self-contained demonstration of exact lower-bound techniques, bridging toy problems with nontrivial combinatorial reasoning.
翻译:本文在仅使用O(1)额外空间的相等比较模型下,精确确定了在包含n+1个不同值的2n元素数组中寻找重复n次的元素所需的比较复杂度。我们提出了一种简单的确定性算法,该算法恰好执行n+2次比较,并证明该界限是紧的:任何正确算法在最坏情况下至少需要n+2次比较。下界证明基于采用图论结构的对手论证。相等查询构建一个不等图I;其补图P(潜在相等图)必须包含两个不相交的n-团或一个(n+1)-团以维持不确定性。我们通过“支柱匹配”构造和边翻转重构技术,证明这些结构在n+1次比较内持续存在,但在n+2次比较时失效。该结果为精确下界证明技术提供了一个具体、自包含的示例,在简单示例问题与非平凡的组合推理之间建立了桥梁。