Skip to content

Instantly share code, notes, and snippets.

@wjkhappy14
Last active April 5, 2016 09:17
Show Gist options
  • Save wjkhappy14/d908cc62f1293c8193195df08b3c0761 to your computer and use it in GitHub Desktop.
Save wjkhappy14/d908cc62f1293c8193195df08b3c0761 to your computer and use it in GitHub Desktop.
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;
}
}
@wjkhappy14
Copy link
Author

插入排序算法

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment