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.
Similar content being viewed by others
Author information
Authors and Affiliations
Corresponding authors
Rights 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
Received:
Published:
Issue Date:
DOI: https://doi.org/10.1007/s00224-005-1237-z