arXiv:2610.18740cs.DSOct 2026

Manuscript Offprint

arXiv:2610.18740

Selecting the 7th Smallest of 16 Elements Takes Exactly 28 Comparisons

Jonathan Cremer

Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.

Abstract

Let Vi(n)V_i(n) denote the minimum worst-case number of comparisons needed to find the ii-th smallest of nn distinct elements. We construct algorithms showing V7(16)≤28V_7(16) \leq 28 and V8(16)≤29V_8(16) \leq 29, improving the previously reported upper bounds of 30 and 31. Together with known lower bounds, these results establish V7(16)=28V_7(16) = 28 and leave V8(16)∈{28,29}V_8(16) \in \{28, 29\}. For 17 elements, we establish V5(17)=27V_5(17) = 27 and improve the upper bounds for ranks 6 through 9 to 29, 30, 31, and 31, respectively. Every new upper bound has an explicit decision-graph certificate verified by a static checker developed independently of the search. We also derive a lower bound for selection from a partially ordered state by combining the Fussenegger–Gabow weight with its order-reversed counterpart. All new upper bounds and this lower bound are formally verified in Lean 4. For V8(16)V_8(16), we show that a lower bound based solely on the total number of decision-tree leaves cannot establish V8(16)≥29V_8(16) \geq 29. The algorithms were found using fixed-budget search, information-guided comparison ordering, and proof-number search. Proof-number search was decisive in finding the 28-comparison algorithm; in our experiments, refuting a comparison budget remained substantially more expensive than finding an algorithm within it.

1 Introduction

Selection asks for the element of a given rank using as few pairwise comparisons as possible. Write Vi(n)V_i(n) for the smallest worst-case number of comparisons needed to find the ii-th smallest of nn distinct elements. Reversing the order shows Vi(n)=Vn+1−i(n)V_i(n) = V_{n+1-i}(n). Classical results include V1(n)=n−1V_1(n) = n - 1 and V2(n)=n−2+⌈log⁡2n⌉V_2(n) = n - 2 + \lceil \log_2 n \rceil (Kislitsyn; see [12]), and the general upper bound of Hadian and Sobel [10],

Vi(n)≤n−i+(i−1)⌈log⁡2(n+2−i)⌉.V_{i}(n)\leq n-i+(i-1)\lceil\log_{2}(n+2-i)\rceil.

Asymptotically, selection takes linear time [2], but even the leading constant for the median is open [3, 7, 6].

Small exact values have been determined by computer search, starting with Gasarch, Kelly and Pugh [9] and Oksanen [14, 15]. Dörrer et al. [5] settled all entries for n≤15n \leq 15 and the first six ranks for n=16n = 16. The two remaining 16-element entries had lower bound 28; with the upper bounds reported in [9, Table 3], the ranges were 28≤V7(16)≤3028 \leq V_7(16) \leq 30 and 28≤V8(16)≤3128 \leq V_8(16) \leq 31.

Theorem 1. V7(16)=V10(16)=28.V_{7}(16) = V_{10}(16) = 28.

Theorem 2. V8(16)=V9(16)≤29V_8(16) = V_9(16) \leq 29. Hence V8(16)∈{28,29}V_8(16) \in \{28, 29\}.

Theorem 3. V5(17)=V13(17)=27V_{5}(17) = V_{13}(17) = 27. Moreover V6(17)≤29V_{6}(17) \leq 29, V7(17)≤30V_{7}(17) \leq 30, V8(17)≤31V_{8}(17) \leq 31, and V9(17)≤31V_{9}(17) \leq 31.

Our contribution to all three theorems is the upper bounds. The lower bound of Theorem 1 is the entry 28–33 of [5, Table 3], obtained there by computer search; we use it without rederiving it. The lower bounds V8(16)≥28V_{8}(16)\geq 28 and V5(17)≥27V_{5}(17)\geq 27 follow from the published values V8(15)=27V_{8}(15)=27 and V5(16)=26V_{5}(16)=26 [5] and the transfer lemma of Section 2. Tables 1 and 2 show the previous and new ranges. The table in [5] lists the Hadian–Sobel values 33 and 36 for the two open 16-element entries; the upper bounds 30 and 31 of [9] are smaller and are the baseline we improve.

ii12345678
before [5, 9]15182124262728–3028–31
this paper1518212426272828–29

Table 1: The row n=16n = 16 of the selection table.

ii123456789
before1620222527–2828–3129–3329–3429–35
this paper162022252728–2929–3029–3129–31

Table 2: The row n=17n = 17. Lower bounds: classical formulas for i≤2i \leq 2, otherwise the row n=16n = 16 of [5] with the transfer lemma. Previous upper bounds: Hadian–Sobel for i≤4i \leq 4 and [9, Table 3] for i≥5i \geq 5.