Advertisement

Theory of Computing Systems

, Volume 39, Issue 3, pp 391–397 | Cite as

Insertion Sort is O(n log n)

  • Michael A. Bender
  • Martin Farach-Colton
  • Miguel A. Mosteiro
Article

Abstract

Traditional Insertion Sort runs in O(n2) time because each insertion takes O(n) time. When people run Insertion Sort in the physical world, they leave gaps between items to accelerate insertions. Gaps help in computers as well. This paper shows that Gapped Insertion Sort has insertion times of O(log n) with high probability, yielding a total running time of O(n log n) with high probability.

Keywords

Binary Search Priority Queue Spreading Factor Insertion Time Rebalance 
These keywords were added by machine and not by the authors. This process is experimental and the keywords may be updated as the learning algorithm improves.

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

Copyright information

© Springer 2006

Authors and Affiliations

  1. 1.Department of Computer Science, SUNY Stony Brook, Stony Brook, NY 11794-4400USA
  2. 2.Department of Computer Science, Rutgers University, Piscataway, NJ 08854USA

Personalised recommendations