 |
|
| |
|
 |
 |
at Global Oneness Community.
Share your dreams and let others help you with the interpretation!
Dream Sharing Forum
|
 |
Insertion sort - Variants |  | Insertion sort - Variants: Encyclopedia II - Insertion sort - Variants |  | D.L. Shell made substantial improvements to the algorithm, and the modified version is called Shell sort. It compares elements separated by a distance that decreases on each pass. Shellsort has distinctly improved running times in practical work, with two simple variants requiring O(n3/2) and O(n4/3) time.
If comparisons are very costly compared to swaps, as is the case for example with string keys stored by reference, then using binary insertion sort can be a good strategy. Binary insertion sort em ...
See also:Insertion sort, Insertion sort - Good and bad input cases, Insertion sort - Variants, Insertion sort - Comparisons to other sorts, Insertion sort - Implementations, Insertion sort - C, Insertion sort - Haskell |  | | Insertion sort, Insertion sort - C, Insertion sort - Comparisons to other sorts, Insertion sort - Good and bad input cases, Insertion sort - Haskell, Insertion sort - Implementations, Insertion sort - Variants |  | |
|  |  | Insertion sort: Encyclopedia II - Insertion sort - Variants
Insertion sort - Variants
D.L. Shell made substantial improvements to the algorithm, and the modified version is called Shell sort. It compares elements separated by a distance that decreases on each pass. Shellsort has distinctly improved running times in practical work, with two simple variants requiring O(n3/2) and O(n4/3) time.
If comparisons are very costly compared to swaps, as is the case for example with string keys stored by reference, then using binary insertion sort can be a good strategy. Binary insertion sort employs binary search to find the right place to insert new elements, and therefore performs comparisons in the worst case, which is Θ(n log n). The algorithm as a whole still takes Θ(n2) time on average due to the series of swaps required for each insertion, and since it always uses binary search, the best case is no longer O(n) but O(n log n).
To avoid having to make a series of swaps for each insertion, we could instead store the input in a linked list, which allows us to insert and delete elements in constant time. Unfortunately, binary search on a linked list is impossible, so we still spend Ω(n2) time searching. If we instead replace it by a more sophisticated data structure such as a heap or binary tree, we can significantly decrease both search and insert time. This is the essence of heap sort and binary tree sort.
In 2004, Bender, Farach-Colton, and Mosteiro published a new variant of insertion sort called library sort or gapped insertion sort that leaves a small number of unused spaces ("gaps") spread throughout the array. The benefit is that insertions need only shift elements over until a gap is reached. Surprising in its simplicity, they show that this sorting algorithm runs with high probability in O(n log n) time. [1]
Other related archivesC, Haskell, In-place, Insertion sort implementations, O, Shell sort, Stable, binary search, binary tree, binary tree sort, bubble sort, comparison sort, data structure, divide-and-conquer algorithms, heap, heap sort, heapsort, library sort, linked list, merge sort, mergesort, online algorithm, quicksort, selection sort, sort algorithm
 Adapted from the Wikipedia article "Variants", under the G.N U Free Docmentation License. Please also see http://en.wikipedia.org/wiki |
|
|
More material related to Insertion Sort can be found here:
|
|
« Back
|
Search the Global Oneness web site |
|
|
|
|
 |
Sneak-Peek of Global Oneness Community
Hi friend! The Global Oneness Community, the place for information and sharing about Oneness is not really launched yet (you will see there is still some clean up to do) ...but it is now open for a sneak-peek! And if you wish - please register and become one of the very first members to do so! Jonas
Forum Home,
Articles,
Photo Gallery,
Videos,
News,
Sitemap
...and much more!
|