- public static void InsertSort (int[] list)
- {
- for (int i = 1; i < list.Length; i++)
- {
- int Temp = list [i];
- int j = i - 1;
- while (j > = 0 && list [j] > Temp)
- {
- list [j + 1] = list [j];
- j-;
- }
- list [j + 1] = Temp;
- }
- }
- //该片段来自于http://www.codesnippet.cn/detail/050920135666.html
来源: http://www.codesnippet.cn/detail/050920135666.html