Last active
April 5, 2016 09:17
-
-
Save wjkhappy14/d908cc62f1293c8193195df08b3c0761 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static void InsertionSort(int[] array, int from, int to) | |
{ | |
for (int i = from + 1; i < to; i++) | |
{ | |
var a = array[i]; | |
int j = i - 1; | |
while (j >= from && array[j] > a) | |
{ | |
array[j + 1] = array[j]; | |
j--; | |
} | |
array[j + 1] = a; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
插入排序算法