标签:ret turn color 排序 code bubble logs span sort
C#
1 public static int[] BubbleSort(int[] array) 2 { 3 int length = array.Length; 4 for(int i=0;i<length-1;i++) 5 { 6 for (int j = 0; j < length - i - 1; j++) 7 { 8 if (array[j] >array[j+1]) 9 { 10 int temp = array[j]; 11 array[j] = array[j+1]; 12 array[j+1] = temp; 13 } 14 } 15 } 16 17 return array; 18 }
标签:ret turn color 排序 code bubble logs span sort
原文地址:http://www.cnblogs.com/huangjianping/p/7123233.html