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

程序员必知的8大排序(三)-------冒泡排序,快速排序(java实现)

时间:2017-03-13 16:02:38      阅读:114      评论:0      收藏:0      [点我收藏+]

标签:bsp   color   java实现   程序员   实现   http   log   冒泡排序   sys   

冒泡排序:http://blog.csdn.net/pzhtpf/article/details/7560294

 1 public class bubbleSort {  
 2 public  bubbleSort(){  
 3      int a[]={49,38,65,97,76,13,27,49,78,34,12,64,5,4,62,99,98,54,56,17,18,23,34,15,35,25,53,51};  
 4     int temp=0;  
 5     for(int i=0;i<a.length-1;i++){  
 6         for(int j=0;j<a.length-1-i;j++){  
 7         if(a[j]>a[j+1]){  
 8             temp=a[j];  
 9             a[j]=a[j+1];  
10             a[j+1]=temp;  
11         }  
12         }  
13     }  
14     for(int i=0;i<a.length;i++)  
15         System.out.println(a[i]);     
16 }  
17 }  

 

程序员必知的8大排序(三)-------冒泡排序,快速排序(java实现)

标签:bsp   color   java实现   程序员   实现   http   log   冒泡排序   sys   

原文地址:http://www.cnblogs.com/manhuidhu/p/6542419.html

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