A General Method for Improving Insertion-Based Adaptive Sorting

Purchase on Springer.com

$29.95 / €24.95 / £19.95*

* Final gross prices may vary according to local VAT.

Get Access

Abstract

A presortedness measure describes to which extent a sequence of key values to be sorted is already partially sorted. We introduce a new natural measure of presortedness, which is a composition of two existing ones: Block that gives the number of already sorted disjoint subsequences of the input, and Loc defined as $\prod^{n}_{i=2} d_i$ , where d i  denotes the distance between the (i − 1)th and the ith element of the input in the ordered sequence up to the ith element. We also give a general method for improving insertion-based adaptive sorting, applying it to Splaysort to produce an algorithm that is optimal with respect to the new composite measure. Our experiments are performed for splay-tree sorting which has been reported to be among the most efficient adaptive sorting algorithms. Our experimental results show that, in addition to the theoretical superiority, our method improves standard Splaysort by a large factor when the input contains blocks of reasonable size.