冒泡算法,似乎第二個循環j應該從i開始,參考
static void bubble_sort(int[] unsorted)
`
{
for (int i = 0; i < unsorted.Length; i++)
{
for (int j = i; j < unsorted.Length; j++)
{
if (unsorted[i] > unsorted[j])
{
int temp = unsorted[i];
unsorted[i] = unsorted[j];
unsorted[j] = temp;
}
}
}
}