标题: //1-100之间的数,给定一个数几次查找能够找到这个数; [打印本页] 作者: liudh1 时间: 2016-4-20 15:02 标题: //1-100之间的数,给定一个数几次查找能够找到这个数; package liu.dh.algorithm1;
public class CopyOfTestBinary {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
//1-100之间的数,给定一个数几次查找能够找到这个数;
//查找search=34,看几次能够找到
int first =1;
int laste = 100;
int count = 0;
while (true) {
int mid = (first+laste)/2;
int search =26;
if (mid==search) {
count++;
break;