算法与数据结构
JYoung_Li
撸码之路漫漫,全栈只是个传说。
展开
-
选择排序
public class selectSort { public static void selectSort(int [] arr){ int min; for(int x = 0; x < arr.length - 1; x++){ min = x; for(int y = x+1;y < arr.length;y++){ if (arr[min] > arr[y原创 2015-10-12 14:59:36 · 273 阅读 · 0 评论 -
二分查找
public class binarySearch { public int find(long searchKey) { int [] a = {9,8,7,6,5,4,3,2,1}; int nElems = 9; int lowerBound = 0; int upperBound = nElems - 1; int curIn; while(true) {原创 2015-10-12 14:09:52 · 317 阅读 · 0 评论 -
冒泡排序
public class bubbleSort { public static void bubbleSort(int [] arr){ for(int x = 0; x < arr.length - 1; x++){ for(int y = 0; y < arr.length - x - 1; y++){ if(arr[y] > arr[y+1]){ int tem原创 2015-10-12 14:19:29 · 274 阅读 · 0 评论