上一页 1 ··· 16 17 18 19 20
摘要: //直接插入排序(无哨兵) 通过测试 public class InsertSortTest{ public static void insertSort(int[] arr) { for (int i = 1; i = 0 && temp < arr[j]; j--) { arr[j + 1] = arr[j]; } arr[j + 1] = temp; } } }//-------------------... 阅读全文
posted @ 2014-03-24 16:51 seven7seven 阅读(191) 评论(0) 推荐(0) 编辑
摘要: //冒泡排序 通过测试public class BubbleSortTest{ public static void bubbleSort(int[] data){ for(int i=0;idata[j+1]){ int temp=data[j]; data[j]=data[j+1]; data[j+1]=temp; } } } }//---------------------------... 阅读全文
posted @ 2014-03-24 16:50 seven7seven 阅读(147) 评论(0) 推荐(0) 编辑
摘要: 之前学习排序算法的时候一直纠结于复杂度问题,原因是网上查到的算法复杂度略有出入,所以本人特地整理了一份,方便大家学习。记住一句话:冒择路(入)兮(希尔)快归堆算法名称最好平均最坏辅助空间稳定性插入直接插入O(n)O(n^2)1稳定折半插入O(nlogn)1稳定希尔排序ShellSortO(nlogn... 阅读全文
posted @ 2014-03-24 16:42 seven7seven 阅读(509) 评论(0) 推荐(0) 编辑
上一页 1 ··· 16 17 18 19 20