冒泡排序

2021-04-11 17:26

阅读:503

标签:stat   pre   i+1   span   out   int   nbsp   sys   system   

 2 
 3 public class MyBubbleSort {
 4     public static void main(String[] args) {
 5         int num[] = {10,8,33,54,1,6,12,43,32,27};
 6         bubbleSort(num);
 7         for (int i = 0; i ) {
 8             System.out.print(num[i] + " ");
 9         }
10     }
11 
12     private static void bubbleSort(int[]num){
13         for (int i = 0; i ) {
14             for (int j = i+1; j ) {
15                 if (num[i]>num[j]){
16                     int temp = num[i];
17                     num[i] = num[j];
18                     num[j] = temp;
19                 }
20             }
21         }
22     }
23 }

 

冒泡排序

标签:stat   pre   i+1   span   out   int   nbsp   sys   system   

原文地址:https://www.cnblogs.com/zz-1120-wtenlb/p/13358957.html


评论


亲,登录后才可以留言!