import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.List; class My { public void bucketSort(double[] a Read More
posted @ 2020-08-02 23:54 执着于风 Views(111) Comments(0) Diggs(0)
import java.util.Arrays; public class My { void insertSort(int[] arr) { int n=arr.length; for(int i=1;i<n;i++){ int temp=arr[i]; int j; for(j=i-1;j>=0 Read More
posted @ 2020-08-02 22:58 执着于风 Views(119) Comments(0) Diggs(0)
import java.util.Arrays; public class My { void shellSort(int[] arr) { int n=arr.length; //当gap=1时,就是直接插入排序 for (int gap = n / 2; gap > 0; gap /= 2) { Read More
posted @ 2020-08-02 22:56 执着于风 Views(71) Comments(0) Diggs(0)
import java.util.Arrays; public class My { public void bubbleSort(int[] arr) { int n=arr.length; int left = 0, right = n - 1; int p = 0; while (left < Read More
posted @ 2020-08-02 22:55 执着于风 Views(189) Comments(0) Diggs(0)
import java.util.Arrays; public class My { void bubbleSort(int[] arr){ int n=arr.length; for(int i=0;i<n-1;i++){ boolean flag=false; for(int j=0;j<n-1 Read More
posted @ 2020-08-02 22:54 执着于风 Views(84) Comments(0) Diggs(0)
import java.util.Arrays; public class My { void quickSort(int[] arr, int start,int end){ if(start>=end){ //必须start>=end return; } int temp=arr[start]; Read More
posted @ 2020-08-02 22:53 执着于风 Views(87) Comments(0) Diggs(0)
import java.util.Arrays; public class My { void selectSort(int[] arr) { int n = arr.length; for (int i = 0; i < n - 1; i++) { int p = i;//定义一个指向最小值的下标 Read More
posted @ 2020-08-02 22:52 执着于风 Views(73) Comments(0) Diggs(0)
import java.util.Arrays; public class My { public void countSort(int[] arr) { int max = arr[0]; int min = arr[0]; for (int a : arr) { if (a > max) { m Read More
posted @ 2020-08-02 22:51 执着于风 Views(108) Comments(0) Diggs(0)
import java.util.Arrays; public class My { public void radixSort(int[] arr) { int max = arr[0]; //初始化最大值 for (int a : arr) { if (a > max) { max = a; } Read More
posted @ 2020-08-02 22:50 执着于风 Views(128) Comments(0) Diggs(0)
import java.util.Arrays; public class My { public void mergeSort(int[] arr, int low, int high) { if (low >= high) { return; } int mid = low + (high-lo Read More
posted @ 2020-08-02 22:49 执着于风 Views(101) Comments(0) Diggs(0)