Best sorting algorithm for nearly sorted lists

  • Authors:
  • Curtis R. Cook;Do Jin Kim

  • Affiliations:
  • Oregon State Univ., Corvallis;National Semi-Conductor, Sunnyvale, CA

  • Venue:
  • Communications of the ACM
  • Year:
  • 1980

Quantified Score

Hi-index 48.22

Visualization

Abstract

Straight Insertion Sort, Shellsort, Straight Merge Sort,Quickersort, and Heapsort are compared on nearly sorted lists. Theratio of the minimum number of list elements which must be removedso that the remaining portion of the list is in order to the sizeof the list is the authors' measure of sortedness. Tests onrandomly generated lists of various combinations of list length andsmall sortedness ratios indicate that Straight Insertion Sort isbest for small or very nearly sorted lists and that Quickersort isbest otherwise. Cook and Kim also show that a combination of theStraight Insertion Sort and Quickersort with merging yields asorting method that performs as well as or better than eitherStraight Insertion Sort or Quickersort on nearly sorted lists.