update insertion sorting part

- fixed lack description of the figure.
This commit is contained in:
y2kbcm1
2018-07-09 19:28:04 -07:00
committed by GitHub
parent 595cc8fd6b
commit 7a236f75ca

View File

@ -24,7 +24,8 @@ __Properties__
### Insertion
![alt text][insertion-image]
From [Wikipedia][insertion-wiki]: Insertion sort is a simple sorting algorithm that builds the final sorted array (or list) one item at a time. It is much less efficient on large lists than more advanced algorithms such as quicksort, heapsort, or merge sort.
From [Wikipedia][insertion-wiki]: Insertion sort is a simple sorting algorithm that builds the final sorted array (or list) one item at a time. It is much less efficient on large lists than more advanced algorithms such as quicksort, heapsort, or merge sort.
In the figure, each bar represents an element of an array that needs to be sorted. What happens at the first intersection of the top most and second top most bars is to swap these elements, represented by bars, because the second element has a higher precedence than the first element does. By repeating this method, insertion sort completes sorting.
__Properties__
* Worst case performance O(n^2)