/** * * @author Administrator * 功能:交换式排序之冒泡排序 */ package com.test1; import java.util.Calendar; public class BubbleSort { public static void main(String[] args) { // TODO Auto-generated method stub int[] arr = new int[50000]; for (int i = 0; i < arr.l…
Notice : these algorithms achieved by Java. So,let's going to it. firstly, what is Bubblesort? why we call it in this name? emmmm.... Maybe this image will give you a clear understanding. Bubblesort.jpg I meet so many descriptions,and they all have a…
package com.pailian; /* * 冒泡排序 * 比较相邻的俩位数,这样每轮比较都会出现一个最大值或最小值 * 下一轮比较就会减少一次(因为已经知道了一个最大值或最小值) * 注意根据需要让升序或降序排列 */ public class BubbleSort { public static void main(String[] args) { int arr[] = {9,6,5,8,4,1,7,2,3}; for (int k = 0; k < arr.length; k++)…