//冒泡 核心代码
for (int i = 0; i < array.count – 1; i++) {
int a = [array[i] intValue];
for (int j = i + 1; j < array.count; j++) {
int b = [array[j] intValue];
if (a > b) {
[array exchangeObjectAtIndex:i withObjectAtIndex:j];
}
}
}
//冒泡 核心代码
for (int i = 0; i < array.count – 1; i++) {
int a = [array[i] intValue];
for (int j = i + 1; j < array.count; j++) {
int b = [array[j] intValue];
if (a > b) {
[array exchangeObjectAtIndex:i withObjectAtIndex:j];
}
}
}
该资源仅限VIP专享下载