Jump to content

Library sort

From Wikipedia, the free encyclopedia

This is an old revision of this page, as edited by 128.101.35.100 (talk) at 00:44, 19 June 2006 (xxx.lanl.gov doesn't imply it's a LANL pub). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

Library sort, or gapped insertion sort is a sorting algorithm much like insertion sort but with unused spaces ("gaps") left in the array being sorted to accelerate subsequent insertions. The benefit is that insertions need only shift elements over until a gap is reached. It was invented in 2004 by Bender, Farach-Colton, and Mosteiro. Surprising in its simplicity, they show that this sorting algorithm runs with high probability in O(n log n) time, much like the randomized variant of quicksort.

Like the insertion sort it is based on, library sort is a stable comparison sort and can be run as an online algorithm.

References