Worst-Case Efficient Sorting with QuickMergesort

11/02/2018
by   Stefan Edelkamp, et al.
0

The two most prominent solutions for the sorting problem are Quicksort and Mergesort. While Quicksort is very fast on average, Mergesort additionally gives worst-case guarantees, but needs extra space for a linear number of elements. Worst-case efficient in-place sorting, however, remains a challenge: the standard solution, Heapsort, suffers from a bad cache behavior and is also not overly fast for in-cache instances. In this work we present median-of-medians QuickMergesort (MoMQuickMergesort), a new variant of QuickMergesort, which combines Quicksort with Mergesort allowing the latter to be implemented in place. Our new variant applies the median-of-medians algorithm for selecting pivots in order to circumvent the quadratic worst case. Indeed, we show that it uses at most n n + 1.6n comparisons for n large enough. We experimentally confirm the theoretical estimates and show that the new algorithm outperforms Heapsort by far and is only around 10 Introsort (std::sort implementation of stdlibc++), which has a rather poor guarantee for the worst case. We also simulate the worst case, which is only around 10 natural candidate to replace Heapsort as a worst-case stopper in Introsort.

READ FULL TEXT

page 1

page 2

page 3

page 4

research
01/29/2018

Generalized Leapfrogging Samplesort: A Class of O(n ^2 n) Worst-Case Complexity and O(n n) Average-Case Complexity Sorting Algorithms

The original Leapfrogging Samplesort operates on a sorted sample of size...
research
06/09/2021

Pattern-defeating Quicksort

A new solution for the Dutch national flag problem is proposed, requirin...
research
04/24/2023

Median of heaps: linear-time selection by recursively constructing binary heaps

The first worst-case linear-time algorithm for selection was discovered ...
research
05/22/2018

On the Worst-Case Complexity of TimSort

TimSort is an intriguing sorting algorithm designed in 2002 for Python, ...
research
11/25/2019

Fast Fibonacci heaps with worst case extensions

We are concentrating on reducing overhead of heaps based on comparisons ...
research
03/23/2015

A Machine Learning Approach to Predicting the Smoothed Complexity of Sorting Algorithms

Smoothed analysis is a framework for analyzing the complexity of an algo...
research
07/28/2020

Distributionally Robust Losses for Latent Covariate Mixtures

While modern large-scale datasets often consist of heterogeneous subpopu...

Please sign up or login with your details

Forgot password? Click here to reset