几个二分法示例
摘要:
/*** 几个二分法* @author tiger*/public class Test {/** * 中间调用多个自身方法 */public void erFenFa(int[] array, int fromIndex, int toIndex, int goal){if(fromIndex > toIndex){ // 这一句非常重要!return;}int middle = (fromIndex + toIndex) / 2;if(array[middle] == goal){System.out.println(goal + "在数组中的索引是:" + mi 阅读全文
posted @ 2010-05-27 19:12 台哥编程课堂 阅读(240) 评论(0) 推荐(0) 编辑