## 这算哪种排序法？？？

private int[] arr;
public void selectSort(){
int len = arr.length;
for(int i=0;i<len-1;i++){
for(int j = i + 1; j<len;j++){
if(arr[j] > arr[i]){
int tmp = arr[i];
arr[i] = arr[j];
arr[j] = tmp;
}
}
}
}

0

0

#### 引用来自“铂金小鸟”的答案

// 1、冒泡排序
public void bubbleSort(){
int len = arr.length;
for(int i = 1; i < len; i ++){
for(int j = 0; j < i; j++){
if(arr[j] < arr[i]){
int tmp = arr[i];
arr[i] = arr[j];
arr[j] = tmp;
}
}
}
}
0
W

0

0

0

0

0
8

0
8
int SelectionSort (const PDATA pdtArr ,const COUNT ctArr) { DATA dtTemp ; PDATA pdtCurrent ,pdtLoop ,pdtNext ,pdtRecord ; if (pdtArr == NULL OR ctArr < SORT_CTARR_MIN OR ctArr > SORT_CTARR_MAX) //Check Inlegal Parameters return ERROR ; const PDATA pdtFirst = pdtArr ; const PDATA pdtOver = pdtFirst + ctArr ; for (pdtNext = (pdtCurrent = pdtFirst) + 1 ; pdtNext < pdtOver ; pdtCurrent = pdtNext++) { pdtRecord = pdtCurrent ; for (pdtLoop = pdtNext ; pdtLoop < pdtOver ; pdtLoop++) #ifdef SORT_ZORDER_DOWN if (*pdtLoop > *pdtRecord) #else if (*pdtLoop < *pdtRecord) #endif pdtRecord = pdtLoop ; if (pdtRecord != pdtCurrent) { dtTemp = *pdtCurrent ; *pdtCurrent = *pdtRecord ; *pdtRecord = dtTemp ; } } return 0 ; //Return Successfully } 只会c的程序员
0