拓冰建站拓冰建站
首页 / 资讯中心 / 正文

选择排序算法

/** * 选择排序。 * author Bright Lee */ public class SelectionSort { public static void sort(int[] array) { for (int i 0; i array.length; i) { int minIndex i; for (int j i 1; j array.length; j) { if (array[j] array[minIndex]) { minIndex j; } } int temp array[i]; array[i] array[minIndex]; array[minIndex] temp; } } public static void main(String[] args) { int[] array new int[] { 13, 2, 29, 11, 80, 1, 12, 11 }; sort(array); for (int i 0; i array.length; i) { int a array[i]; System.out.print(a , ); } } }青蛙客服系统https://download.csdn.net/download/look4liming/93326820
分享:

看完干货,该让你的企业上线了

免费需求沟通 · 48 小时内出具建站方案 · 河南本地可上门