Rotated library sort

  • Authors:
  • Franky Lam;Raymond K. Wong

  • Affiliations:
  • University of New South Wales, NSW, Australia;University of New South Wales, NSW, Australia and National ICT Australia, Australia

  • Venue:
  • CATS '13 Proceedings of the Nineteenth Computing: The Australasian Theory Symposium - Volume 141
  • Year:
  • 2013

Quantified Score

Hi-index 0.00

Visualization

Abstract

This paper investigates how to improve the worst case runtime of Insertion Sort while keeping it in-place, incremental and adaptive. To sort an array of n elements with w bits for each element, classic Insertion Sort runs in O(n2) operations with wn bits space. Gapped Insertion Sort has a runtime of O(n lg n) with a high probability of only using (1 + ε)wn bits space. This paper shows that Rotated Insertion Sort guarantees O(√n lg n) operations per insertion and has a worst case sorting time of O(n1.5 lg n) operations by using optimal O(w) auxiliary bits. By using extra Θ(√n lg n) bits and recursively applying the same structure l times, it can be done with O(2l n1+1/l) operations. Apart from the space usage and time guarantees, it also has the advantage of efficiently retrieving the i-th element in constant time. This paper presents Rotated Library Sort that combines the advantages of the above two improved approaches.