java https://www.youtube.com/watch?v=f8hXR_Hvybo(https://www.youtube.com/watch?v=f8hXR_Hvybo)

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了java https://www.youtube.com/watch?v=f8hXR_Hvybo(https://www.youtube.com/watch?v=f8hXR_Hvybo)相关的知识,希望对你有一定的参考价值。

public class MySelectionSort {     public static int[] doSelectionSort(int[] arr){         for (int i = 0; i < arr.length - 1; i++)         {             int index = i;             for (int j = i + 1; j < arr.length; j++)                 if (arr[j] < arr[index])                     index = j;             int smallerNumber = arr[index];             arr[index] = arr[i];             arr[i] = smallerNumber;         }         return arr;     }     public static void main(String a[]){         int[] arr1 = {10,34,2,56,7,67,88,42};         int[] arr2 = doSelectionSort(arr1);         for(int i:arr2){             System.out.print(i);             System.out.print(", ");         }     } }

以上是关于java https://www.youtube.com/watch?v=f8hXR_Hvybo(https://www.youtube.com/watch?v=f8hXR_Hvybo)的主要内容,如果未能解决你的问题,请参考以下文章