直接插入排序
public static void InsertionSort()
{
var a = new[] { 10, 23, 14, 24, 57, 3, 7, 19, 87, 11 };
int i, j, temp;
for (i = 1; i < a.Length; i++)
{
temp = a[i];
j = i;
while (j> 0 && (a[j-1]>=temp))
{
a[j] = a[j - 1];
--j;
}
a[j] = temp;
}
foreach (var i1 in a)
{
Console.WriteLine(i1);
}
Console.Read();
}