Copyright © Philip M. Parker, INSEAD. Terms of Use.

| Domain | Definition |
Computing | Insertion sort A sorting algorithm that inserts each item in the proper place into an initially empty list by comparing it with each item in the list until it finds the new element's successor or the end of the list. Compare bubble sort. (1997-02-12). Source: The Free On-line Dictionary of Computing. |
Math | Sort by repeatedly taking the next item and inserting it into the final data structure in its proper order with respect to items already inserted. Run time is O(n2) because of moves. (references) |
Source: compiled by the editor from various references; see credits. | |
(From Wikipedia, the free Encyclopedia)
Insertion sort is a simple sort algorithm where the result is built up one entry at a time.
In abstract terms, each iteration of an insertion sort removes an element from the input data, inserting it at the correct position in the already sorted list, until no elements are left in the input. The choice of which element to remove from the input is arbitrary.
Sorting is done in-place. The result array after k iterations contains the first k entries of the input array and is sorted. In each step, the first remaining entry of the input is removed, inserted into the result at the right position, thus extending the result:
becomes:+------ result ------+------ input ------+ | <= x | > x | x | ... | +--------------------+-------------------+
with each element > x copied to the right as it is compared against x.+-------- result --------+---- input ----+ | <= x | x | > x | ... | +------------------------+---------------+
The algorithm can be described as:
def straightinsertionsort(array):
for removed_index in range(1, len(array)):
removed_value = array[removed_index]
insert_index = removed_index
while insert_index > 0 and array[insert_index - 1] > removed_value:
array[insert_index] = array[insert_index - 1]
insert_index = insert_index - 1
array[insert_index] = removed_value
One coding using a functional programming language such as Haskell might be:
> insert :: Ord a => a -> [a] -> [a] > insert item [] = [item] > insert item (h:t) | item <= h = item:h:t > | otherwise = h:(insert item t)> insertsort :: Ord a => [a] -> [a] > insertsort [] = [] > insertsort (h:t) = insert h (insertsort t)
Insertion sort is very similar to bubble sort. In bubble sort, after k passes through the array, the k largest elements have bubbled to the top. (Or the k smallest elements have bubbled to the bottom, depending on which way you do it.) In insertion sort, after k passes through the array, you have a run of k sorted elements at the bottom of the array. Each pass inserts another element into the sorted run. So with bubble sort, each pass takes less time than the previous one, but with insertion sort, each pass may take more time than the previous one.
In the best case of an already sorted array, this implementation of insertion sort takes O(n) time: in each iteration, the first remaining element of the input is only compared with the last element of the result. It takes O(n2) time in the average and worst cases, which makes it impractical for sorting large numbers of elements. However, insertion sort's inner loop is very fast, which often makes it one of the fastest algorithms for sorting small numbers of elements, typically less than 10 or so.
D.L. Shell made an improvement to the algorithm, called Shellsort, that compares elements separated by a distance that decreases on each pass. Quicksort works by dividing the array to be sorted into smaller runs to be sorted separately; highly optimized implementations of Quicksort often use insertion sort to sort these runs once they get small enough.
Source: adapted by the editor from Wikipedia, the free encyclopedia under a copyleft GNU Free Documentation License (GFDL) from the article "Insertion sort."
Crosswords: INSERTION SORT |
| Specialty definitions using "INSERTION SORT": binary insertion sort ♦ diminishing increment sort ♦ garbageabetical order. (references) |
| The following statistics estimate the number of searches per day across the major English-language search engines as identified by various trade publications. Hyperlinks lead to commercial use of the expression at Amazon.com. |
| Expression | Frequency per Day |
insertion sort | 22 |
algorithm insertion sort | 3 |
c++ insertion sort | 3 |
insertion insertion sort sort | 2 |
| Source: compiled by the editor from various references; see credits. | |
Scrabble® Enable2K-Verified Anagrams | |
| Words within the letters "e-i-i-n-n-o-o-r-r-s-s-t-t" | |
-3 letters: insertions, internists, ironstones, nonrioters, nonstories, serotonins, sonorities, sororities, sortitions, torosities, tretinoins. | |
-4 letters: insertion, insistent, interiors, internist, ironstone, nonrioter, serotonin, snootiest, sortition, tenorists, tinstones, tortoises, tretinoin. | |
-5 letters: erosions, inosites, insister, interior, intoners, introits, introrse, ironists, ironness, isotones, nitrites, noisiest, notornes, notornis, oestrins, osteitis, resistor, risottos, roisters, roosters, rootiest, sinister, snootier, snorters, snottier, sootiest, sorriest. | |
| Words containing the letters "e-i-i-n-n-o-o-r-r-s-s-t-t" | |
+4 letters: contradictoriness, reconstructionism, reconstructionist. | |
+5 letters: reconstructionisms, reconstructionists. | |
| Source: compiled by the editor from various references; see credits. SCRABBLE® is a registered trademark. All intellectual property rights in and to the game are owned in the U.S.A and Canada by Hasbro Inc., and throughout the rest of the world by J.W. Spear & Sons Limited of Maidenhead, Berkshire, England, a subsidiary of Mattel Inc. Mattel and Spear are not affiliated with Hasbro. | |
Hexadecimal (or equivalents, 770AD-1900s) (references)49 4E 53 45 52 54 49 4F 4E      53 4F 52 54 |
| Leonardo da Vinci (1452-1519; backwards) (references)
|
Binary Code (1918-1938, probably earlier) (references)01001001 01001110 01010011 01000101 01010010 01010100 01001001 01001111 01001110 00100000 01010011 01001111 01010010 01010100 |
HTML Code (1990) (references)I N S E R T I O N   S O R T |
ISO 10646 (1991-1993) (references)0049 004E 0053 0045 0052 0054 0049 004F 004E      0053 004F 0052 0054 |
Encryption (beginner's substitution cypher): (references)434853395254434948253495254 |
| 1. Crosswords 2. Expressions: Internet 3. Anagrams 4. Orthography | 5. Bibliography |
Copyright © Philip M. Parker, INSEAD. Terms of Use.