I. Java implementation of Bubble Sorting
Public void bubblesort (INT [] array) {int Len = array. length; int temp = 0; // number of cycles: array. lengthfor (INT I = 0; I <Len; I ++) {// in each loop, move the maximum number of len-I numbers before the array to the position of array [len-i-1] For (Int J = 1; j <len-I; j ++) {// This sorting algorithm is ascending. If (array [J-1]> array [J]) {temp = array [J-1]; array [J-1] = array [J]; array [J] = temp ;}}}}
Ii. Java implementation of quick sorting
Public void quicksort (INT [] array) {quicksort (array, 0, array. length-1);} private void quicksort (INT [] array, int begin, int end) {// If the array is empty or there is only one element, if (begin> = END) return; int middle = partition (array, begin, end); quicksort (array, begin, middle-1); quicksort (array, middle + 1, end);} private int partition (INT [] array, int begin, int end) {// use the value of array [end] as the demarcation point, so that the value on the left of the array is less than or equal to it, and the value on the right is greater than int value = array [end]; // I as the index, its next location is the first location of a large number, int I = begin-1; int temp = 0; For (Int J = begin; j <end; j ++) {If (array [J] <= value) {I ++; temp = array [I]; array [I] = array [J]; array [J] = temp;} I ++; array [end] = array [I]; array [I] = value; return I ;}
III,