Comparison method violates its general contract!

ComparatorVerifier is a library for verifying Comparators. Check it out! Java’s standard sorting algorithm, TimSort, is a clever hybrid algorithm that uses a deceptively simple insight about the typical pattern of elements in arrays. Unfortunately the insight is couched deep in mathematical obscurity: Entropy considerations provide a natural estimate of the number of comparisons to sort incompletely shuffled data. From an information theoretic viewpoint, the number of comparisons needed to sort a permutation is an upper bound on the Kolmogorov complexity of the permutation....

4 April 2025 · 2243 words