冒泡排序
冒泡排序
QList<int> Qt_2022121201::sortList(QList<int> list_param) { for (int k = 0; k < list_param.size()-1;k++) { for (int j = 0; j < list_param.size() - k-1; j++) { if (list_param[j]>list_param[j+1]) { int indexNum = list_param[j]; list_param[j] = list_param[j + 1]; list_param[j + 1] = indexNum; } } } return list_param; }
排序结果:
9,7,4,12,6,11,5,22,26,28,1,52 Result:[1,4,5,6,7,9,11,12,22,26,28,52,]
#############
QQ 3087438119