进行二分查找有四个步骤:
第一步:while(start+1<end) //之所以需要这么写,是可能在后面使用到这两个位置,比如leetcode上需要找11223344,里面的2元素,start和end就可以返回这两个位置。
第二步:mid=start+(end-start)/2
第三步:==,>,<;
进行二分查找有四个步骤:
第一步:while(start+1<end) //之所以需要这么写,是可能在后面使用到这两个位置,比如leetcode上需要找11223344,里面的2元素,start和end就可以返回这两个位置。
第二步:mid=start+(end-start)/2
第三步:==,>,<;
unsigned int MAX = 32; // 2的5次方 unsigned int index = 31; index = (index + 100) % MAX; printf ("inde