请编程实现一个冒泡排序算法

来源:互联网 发布:数据爆炸 英语怎么说 编辑:程序博客网 时间:2024/05/21 09:16

int [] array = new int [] ;

int temp = 0 ;

for (int i = 0 ; i < array.Length - 1 ; i++)

{

for (int j = i + 1 ; j < array.Length ; j++)

{

if (array[j] < array[i])

{

temp = array[i] ;

array[i] = array[j] ;

array[j] = temp ;

}

}

}

原创粉丝点击