下面介绍的是啊哈算法的冒泡排序算法: #include <stdio.h> int main() { int a[100], i, j, t, n; scanf("%d", &n); for (i = 1; i <= n; i++) scanf("%d", &a[i]); for (i=1; i<= n-1; i++) { for (j=1; j<=n-i; j++) { if (a[j] < a[j+1]) {
稍微轻松点,彻底理解了一下这三个算法,当然只是部分,还有什么改良版,具体分类等等,不过下周有事,先把这几个典型的弄明白,老规矩,看代码说问题 /** * Created by fanyafeng on 2015/5/8/0008. */ public class ALGTest { public static void main(String[] args) { System.out.println("排序算法"); System.out.println("---------