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.
This article is licensed under the GNU Free Documentation License.
It uses material from the
"Library sort".
Home Page • arts • business • computers • games • health • hospitals • home • kids & teens • news • physicians • recreation• reference • regional • science • shopping • society • sports • world