[排序]冒泡排序
说明
unsorted[ ]
为未排序数组length
为未排序数组长度
使用方法
bubble_sort(数组,长度)
模板
void bubble_sort(int[] unsorted,int length)
{
for (int i = 0; i < length; i++)
for (int j = i; j < length; j++)
if (unsorted[i] > unsorted[j])
{
int temp = unsorted[i];
unsorted[i] = unsorted[j];
unsorted[j] = temp;
}
}