zoukankan      html  css  js  c++  java
  • <---java-->冒泡排序

    package book;
    
    /**
     * @Auther tangzekai
     * @Description:
     * @Date:Created in 11:09 2017/7/3
     * @Modified By:
     */
    public class ChooseSort {
        public static void selectSort(int[] a) {
            int i,t;
            for (t = 0; t < a.length-1; t++) {
                for (i = 0; i < a.length-1; i++) {
                    int temp;
                    if (a[i] >= a[i + 1]) {
                        temp = a[i + 1];
                        a[i + 1] = a[i];
                        a[i] = temp;
                    }
                }
            }
            for (int x = 0; x < a.length; x++) {
                if (x == a.length - 1) {
                    System.out.print(a[x]);
                } else
                    System.out.print(a[x] + "-");
            }
        }
    
        public static void main(String[] args) {
            int[] b = {77, 22, 3, 55, 47, 96, 12, 12, 15, 11, 19, 33};
            selectSort(b);
    
    
        }
    }
  • 相关阅读:
    Day 9
    Day 8
    Day 7
    Day 6
    Day 5
    Day 4
    Day 3
    Day 2
    Day 1
    解决vue-cli3不停请求 /sockjs-node/info?t= 问题
  • 原文地址:https://www.cnblogs.com/tangzekai/p/7111526.html
Copyright © 2011-2022 走看看