码迷,mamicode.com
首页 > 编程语言 > 详细

冒泡排序

时间:2018-11-11 20:09:41      阅读:149      评论:0      收藏:0      [点我收藏+]

标签:get   arraylist   turn   color   for   nbsp   bbb   array   col   

   冒泡一:
public static int[] GetBubbbleSort( int[] ArrayList) 2 { 3 for (int i = 0; i < ArrayList.Length-1; i++) 4 { 5 for (int j = 0; j < ArrayList.Length-i-1; j++) 6 { 7 int temp; 8 //大于为从小到大,小于为从大到小 9 if (ArrayList[j]>ArrayList[j+1]) 10 { 11 temp = ArrayList[j]; 12 ArrayList[j] = ArrayList[j + 1]; 13 ArrayList[j+1] = temp; 14 } 15 } 16 } 17 return ArrayList; 18 }

 

冒泡排序

标签:get   arraylist   turn   color   for   nbsp   bbb   array   col   

原文地址:https://www.cnblogs.com/xiaobing1/p/9943076.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!