Merge Strategies: from Merge Sort to TimSort - Archive ouverte HAL Access content directly
Preprints, Working Papers, ... Year : 2015

Merge Strategies: from Merge Sort to TimSort

Abstract

The introduction of TimSort as the standard algorithm for sorting in Java and Python questions the generally accepted idea that merge algorithms are not competitive for sorting in practice. In an attempt to better understand TimSort algorithm, we define a framework to study the merging cost of sorting algorithms that relies on merges of monotonic subsequences of the input. We propose an optimal strategy for lists and a 2-approximation for arrays. We compare them to the merging strategy of TimSort by designing a simpler yet competitive algorithm based on the same ideas. As a side benefit, our framework allows to establish the announced running time of TimSort, that is O(n log n).
Fichier principal
Vignette du fichier
aunipi2016-merge-sorts.pdf (438.13 Ko) Télécharger le fichier
Origin : Files produced by the author(s)

Dates and versions

hal-01212839 , version 1 (07-10-2015)
hal-01212839 , version 2 (09-12-2015)

Identifiers

  • HAL Id : hal-01212839 , version 1

Cite

Nicolas Auger, Cyril Nicaud, Carine Pivoteau. Merge Strategies: from Merge Sort to TimSort. 2015. ⟨hal-01212839v1⟩
5298 View
5465 Download

Share

Gmail Facebook X LinkedIn More