void build(int idx,int x)
{
if(a[idx]==0) a[idx]=x;
else if(x>a[idx]) build(idx<<1|1,x);
else if(x<a[idx]) build(idx<<1,x);
}
数组模拟二叉搜索树
最新推荐文章于 2023-02-07 00:00:11 发布
void build(int idx,int x)
{
if(a[idx]==0) a[idx]=x;
else if(x>a[idx]) build(idx<<1|1,x);
else if(x<a[idx]) build(idx<<1,x);
}