【问题标题】:How i turn this programme in selection sort我如何把这个程序变成选择排序
【发布时间】:2016-01-07 02:01:38
【问题描述】:
import java.util.*;
class Example {
  public static void bubbleSort(int[] a) {
    for (int k=a.length-1; k>0; k--) {
      for (int i=0; ia[i+1]) {
        int temp=a[i];
        a[i]=a[i+1];
        a[i+1]=temp;
      }
      System.out.println(Arrays.toString(a));
      try {
        Thread.sleep(500);
      } catch(Exception e){}
    }
  }
}

public static void main(String args[]) {
  int[] ar={98,78,56,34,23,58,21,67,37,8};
  System.out.println(Arrays.toString(ar));
  bubbleSort(ar);
  System.out.println(Arrays.toString(ar));
}
}

【问题讨论】:

    标签: java arrays


    【解决方案1】:

    转到谷歌,输入“Java 选择排序”并点击任何搜索结果。 例如:http://www.java2novice.com/java-sorting-algorithms/selection-sort/

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-04-29
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多