using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Sort
{
class Insert
{
public static void InsertSort(List<int> list)
{
int tmp, j;
for (int i = 1; i < list.Count; ++i)
{
if (list[i] < list[i - 1])
{
tmp = list[i];
for (j = i - 1; j >= 0 && tmp < list[j]; --j)
{
list[j + 1] = list[j];
}
//for (j = i - 1; j >= 0;)
//{
// if (tmp < list[j])
// {
// list[j + 1] = list[j];
// --j;
// }
// else
// {
// break;
// }
//}
list[j + 1] = tmp;
}
}
}
}
}