⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 bubblesort.java

📁 用Java实现的数据结构四种排序算法
💻 JAVA
字号:
//BubbleSort.java
//冒泡排序
//09_22
/////////////////////////////////
package classfile;

public class BubbleSort{

	public static void BubbleSortApp(int[] a,int len){
		int i,j;
		int temp;
		for(i=0;i<len;i++){
			for(j=0;j<len-i-1;j++){//??????????????
				if(a[j]>a[j+1]){
					temp=a[j];
					a[j]=a[j+1];
					a[j+1]=temp;
				}
			}
		}
	}
	public static void Display(int[] a,int len){
			int i;
			for(i=0;i<len;i++){			
				System.out.println(a[i]);
			}
	}
	public static void main(String[] args){
		int a[]={49,27,9,17,55,89,76};
		BubbleSortApp(a,7);
		Display(a,7);
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -