时间复杂度: N^2
for (int i = 0; i < 5; i++)
{
for (int j = i + 1; j < 5; j++)
{
if (unsorted[i] < unsorted[j]) {
int temp = unsorted[i];
unsorted[i] = unsorted[j];
unsorted[j] = temp;
}
}
}
网友评论