Commit a318f08
authored
Create InsertionSort.py
Insertion Sort Implementation In Python
In order to rank an array of size N ascendingly:
Over the array, iterate from arr[1] to arr[N].
Comparing the current (key) element to the previous one.
Compare the key element to the previous elements to see if it is smaller. In order to make room for the substituted element, move the larger elements up one position.1 parent 9629aef commit a318f08
1 file changed
+17
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
0 commit comments