首页 > 代码库 > BubbleSort

BubbleSort

int[] iArrary = new int[] { 1, 5, 13, 6, 10, 55, 99, 2, 87, 12, 34, 75, 33, 47 };
for (int i = 0; i < iArrary.Length; i++)
{
for (int j = i + 1; j < iArrary.Length; j++)
{
if (iArrary[i] > iArrary[j])
{
int temp = iArrary[i];
iArrary[i] = iArrary[j];
iArrary[j] = temp;
}
}
}

BubbleSort