Skip to main content
Log in

Insertion Sort is O(n log n)

  • Published:
Theory of Computing Systems Aims and scope Submit manuscript

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.

This is a preview of subscription content, log in via an institution to check access.

Access this article

Price excludes VAT (USA)
Tax calculation will be finalised during checkout.

Instant access to the full article PDF.

Similar content being viewed by others

Author information

Authors and Affiliations

Authors

Corresponding authors

Correspondence to Michael A. Bender, Martin Farach-Colton or Miguel A. Mosteiro.

Rights and permissions

Reprints and permissions

About this article

Cite this article

Bender, M., Farach-Colton, M. & Mosteiro, M. Insertion Sort is O(n log n). Theory Comput Syst 39, 391–397 (2006). https://doi.org/10.1007/s00224-005-1237-z

Download citation

  • Received:

  • Published:

  • Issue Date:

  • DOI: https://doi.org/10.1007/s00224-005-1237-z

Keywords

Navigation