An Optimal Sorting Algorithm for Persistent Random Comparison Faults
Abstract
We consider the problem of sorting elements subject to persistent random comparison errors. In this problem, each comparison between two elements can be wrong with some fixed (small) probability , and comparing the same pair of elements multiple times always yields the same result. Sorting perfectly in this model is impossible, and the objective is to minimize the dislocation of each element in the output sequence, i.e., the difference between its position in the sequence and its true rank. In this paper, we present the first -time sorting algorithm that guarantees both maximum dislocation and total dislocation with high probability when . This settles the time complexity sorting with persistent comparison errors in the given range of and shows that comparison errors do not increase its computational difficulty. Indeed, time is necessary to archive a maximum dislocation of even without comparison errors. Moreover, we prove that no algorithm can guarantee a maximum dislocation of with high probability, nor a total dislocation of in expectation. To develop our sorting algorithm, we solve two related sub-problems, which might be of independent interest. More precisely, we show that time suffices to find a position in which to insert a new element in an almost-sorted sequence of elements having dislocation at most , so that the dislocation of in the resulting sequence is with high probability (which can be equivalently thought as the problem of estimating the rank of in ). We also show that the maximum (resp. total) dislocation of an approximately sorted sequence of elements can be lowered to (resp. ) in time, w.h.p., where is an upper bound on the maximum dislocation of .
Cite
@article{arxiv.2508.19785,
title = {An Optimal Sorting Algorithm for Persistent Random Comparison Faults},
author = {Barbara Geissmann and Stefano Leucci and Chih-Hung Liu and Paolo Penna},
journal= {arXiv preprint arXiv:2508.19785},
year = {2025}
}