1.search()函数
2.struct结构体
(1)
3.二分搜索
int ret = -1;int left = 0; int right = len-1; while ( right > left )1 int mid = ( left+right)/2;if ( a[mid] = k ) { ret = mid;break; }else if ( a[mid]>k ){ right = mid-1;}else i left = mid+1; }
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)