Adaptive sorting: an information theoretic perspective

  • Authors:
  • Amr Elmasry;Michael L. Fredman

  • Affiliations:
  • Alexandria University, Department of Computer Engineering and Systems, Alexandria, Egypt;Rutgers University, Department of Computer Science, 08903, New Brunswick, NJ, USA

  • Venue:
  • Acta Informatica
  • Year:
  • 2008

Quantified Score

Hi-index 0.00

Visualization

Abstract

We present two algorithms that are near optimal with respect to the number of inversions present in the input. One of the algorithms is a variation of insertion sort, and the other is a variation of merge sort. The number of comparisons performed by our algorithms, on an input sequence of length n that has I inversions, is at most $$n\,{\rm log}_{2} (\frac{I}{n} + 1) + O(n)$$. Moreover, both algorithms have implementations that run in time $$O(n\,{\rm log}_{2} (\frac{I}{n} + 1)\,+\,n)$$. All previously published algorithms require at least $$cn\,{\rm log}_{2} (\frac{I}{n} + 1)$$ comparisons for some c  1.