Data structure: Array
Worst case performance: O(n^{2}) comparisons, swaps
Best case performance: O(n) comparisons, O(1) swaps
Average case performance: O(n^{2}) comparisons, swaps
Insertion sort iterates through the list by consuming one input element at each repetition, and growing a sorted output list. On a repetition, insertion sort removes one element from the input data, finds the location it belongs within the sorted list, and inserts it there. It repeats until no input elements remain.

Algorithm:
Example:
The following table shows the steps for sorting the sequence {3, 7, 4, 9, 5, 2, 6, 1}. In each step, the key under consideration is underlined. The key that was moved (or left in place because it was biggest yet considered) in the previous step is shown in bold.
http://www.java2novice.com/java-sorting-algorithms/insertion-sort/
Worst case performance: O(n^{2}) comparisons, swaps
Best case performance: O(n) comparisons, O(1) swaps
Average case performance: O(n^{2}) comparisons, swaps
Insertion sort iterates through the list by consuming one input element at each repetition, and growing a sorted output list. On a repetition, insertion sort removes one element from the input data, finds the location it belongs within the sorted list, and inserts it there. It repeats until no input elements remain.

Algorithm:
//insertion sort algo where we keep comparing the current element arr[i] with elements from indexes
//(i to 0) and keep shifting elements to the right to free a space for arr[i]
insertionSort(arr)
for every element i in arr{
currentElement = arr[i]
j = i - 1;
while(j > 0){
if(currentElement < arr[j]){
// shift elements to right
arr[j+1] = arr[j]
}
j--;
}
swap(arr[i], arr[j])
}
The following table shows the steps for sorting the sequence {3, 7, 4, 9, 5, 2, 6, 1}. In each step, the key under consideration is underlined. The key that was moved (or left in place because it was biggest yet considered) in the previous step is shown in bold.
3 7 4 9 5 2 6 1
3 7 4 9 5 2 6 1
3 7 4 9 5 2 6 1
3 4 7 9 5 2 6 1
3 4 7 9 5 2 6 1
3 4 5 7 9 2 6 1
2 3 4 5 7 9 6 1
2 3 4 5 6 7 9 1
1 2 3 4 5 6 7 9
Insertion sort is very similar to selection sort. As in selection sort, after k passes through the array, the first k elements are in sorted order. For selection sort these are the k smallest elements, while in insertion sort they are whatever the first k elements were in the unsorted array. Insertion sort's advantage is that it only scans as many elements as needed to determine the correct location of the k+1st element, while selection sort must scan all remaining elements to find the absolute smallest element.
https://en.wikipedia.org/wiki/Insertion_sort