文章
5
粉丝
492
获赞
1
访问
36.6k
#include <stdio.h>
#include <vector>
using namespace std;
int binary_search1(vector<int> &bed, int l, int r, int target)
{
int mid = (r + l) / 2, a;
a = bed[mid];
if (a == target)
{
return 1;
}
else if (a > target)
{
if (l == r)
{
bed.insert(bed.begin() + r , target);
return 0;
}
else return binary_search1(bed, l, mid, target);
}
else
{
if (l == r)
{
&nbs...
登录后发布评论
暂无评论,来抢沙发