摘要:
归并算法的中心是归并两个已经有序的数组1. 思想演示:非递归 public static void merge( int[] arrayA, int sizeA, int[] arrayB, int sizeB, int[] arrayC ) { int aDex=0, bDex=0, cDex=0; while(aDex < sizeA && bDex < sizeB) // neither array empty if( a... 阅读全文
posted @ 2014-03-14 15:41
hezhixue
阅读(116)
评论(0)
推荐(0)
摘要:
1. 冒泡排序 public void bubbleSort() { int out, in; for(out=nElems-1; out>1; out--) // outer loop (backward) for(in=0; in a[in+1] ) // out of order? swap(in, in+1); // swap them } // end bubbleSort()2. 选择排序public void selectionSort() { ... 阅读全文
posted @ 2014-03-14 15:11
hezhixue
阅读(164)
评论(0)
推荐(0)