int IdxSerch(SeqList A[],IdxType index[],int b,KeyType k,int n) {
//分块查找关键字为k的记录,索引表为
index[0..b-1]
int low=0,high=b-1,mid,i;
int s=n/b; //每块记录个数
while(low<=high)
{
//在索引表中进行二分查找,找到的位置放在low中
mid=(low+high)/2;
if(index[mid].key
}
if(low {
//在顺序表中顺序查找
for(i=index[low].link;i<=index[low].link+s-1 && i
return -1;
}
return -1;
}
typedef struct node
{
KeyType key;
//结点中的关键字
struct node *lchild,*rchild; //左、右孩子指针
}BsTree;
BsTree *BstSeareh(BsTree *BST,KeyType k ,BsTree **parent)
{
BsTree *p=BST,*q=NULL; //p指向根结点,q指向*p的双亲
while(p!=NULL)
{
if(k==p->key)
{ //查找成功
*parent=q;
return (p);
}
q=p;
if(k
//在左子树中查找
else p=p->rchild; //在右子树中查找
}
*parent=q;
return (p);
//查找失败,返回空
}