用递归方法实现二分查找,为了避免异常情况,首先判断上下限范围
用递归方法实现二分查找,为了避免异常情况,首先判断上下限范围int binarysearch(int source[],int low,int,high,int targetvalue){ if (low>high) return; int temp= (high-low)/2+low; if(source[temp]>targetvalue) binarysearch(source,low,temp-1,targetvalue); if(source[
原创
2020-05-20 09:30:30 ·
261 阅读 ·
0 评论