冒泡法排序
/// <summary> /// 冒泡法排序 /// </summary> /// <param name="array">乱序的数字数组</param> /// <returns>排顺后的数组</returns> public int[] maobaofa(int[] array) { int temp = 0; for (int i = 0; i < array.Length - 1; i++) { for (int j = i + 1; j < array.Length; j++) { if (array[j] < array[i]) { temp = array[i]; array[i] = array[j]; array[j] = temp; } } } return array; }