摘要: 插入排序:将下一个插入已排好的序列中自己觉得演示的号的一个文章地址http://sjjg.js.zwu.edu.cn/SFXX/sf1/zjcr.html下面是java的实现代码://InsertSort public class TestInsertSort { public int[] testInsertSortArray(int[] arr){ for(int i = 1; i0 && arr[j-1] > temp){ arr[j] = arr[j-1]; j --; ... 阅读全文
posted @ 2013-09-05 18:29 Ruth/Christy 阅读(181) 评论(0) 推荐(0) 编辑
摘要: //SelectSort (( O(n²)))public class TestSelectSort { public int[] selectSortArray(int[] arr){ int min_index; for(int i = 0; i <arr.length - 1; i ++){ min_index = i; for(int j = i + 1; j < arr.length; j ++){ if(arr[j] < min_index){ ... 阅读全文
posted @ 2013-09-05 18:12 Ruth/Christy 阅读(175) 评论(0) 推荐(0) 编辑
摘要: //Bubble Sort ( O(n²))public class TestBubbleSort { public int[] bubbleSortArray(int[] arr){ for(int i = 1 ; i arr[j+1]){ int temp; temp = arr[j]; arr[j] = arr[j+1]; arr[j+1] = temp; } ... 阅读全文
posted @ 2013-09-05 18:10 Ruth/Christy 阅读(141) 评论(0) 推荐(0) 编辑