2014年2月18日
摘要: 1 public static int BiSearch(int[] A,int len,int w) 2 {//二分查找,返回的是刚刚大于w的值的下标,这个值要被w替换掉。因为记录数组总是有序的,所以用二分查找很明智。 3 int left=0; 4 int right=len-1;//len是现在数组有几个元素的长度,而不是数组的长度。 5 int middle=0; 6 while(leftw)10 right=middle-1;11 else if(... 阅读全文
posted @ 2014-02-18 12:14 happinessqi 阅读(443) 评论(0) 推荐(0) 编辑