class Bubble_Sort
{
/**
n o w j a v a . c o m - 时代Java
**/
// function for bubble sort
public static void BubbleSort(int[] array, int size)
{
int temp;
for(int i = 0; i < size - 1; i++)
{
for(int j = 0; j < size - i - 1; j++)
{
if(array[j] > array[j + 1])
{
temp = array[j];
array[j] = array[j + 1];
array[j + 1] = temp;
}
}
}
//from N o w J a v a . c o m
}
// function ro print array
public static void Print_Array(int[] array, int size)
{
for(int i = 0; i < size; i++)
System.out.print(array[i] + " ");
System.out.println();
}
/**代码未完, 请加载全部代码(NowJava.com).**/
本文系作者在时代Java发表,未经许可,不得转载。如有侵权,请联系nowjava@qq.com删除。