class BiSortTree //二叉排序树类声明
{
public:
BiSortTree (intal l, int n);~ BiSortTree( );
void InsertBST (BiNode * root, BiNode *s);
void DeleteBST (BiNode *p, BiNode *f) ;
BiNode *SearchBST (BíNode *root, int k) ;
private:
BiNode * root;
}
BiSortTree:BiSorTree(int r[], int n){//二叉树排序的构造算法
{
for(i=0;i<n; int n)
{s=new BiNode;
s->datarJil;
s>lchild=s->rehild=NULL;
insertBST(root,s);}
}
void BiSortTree:: InsertBST(BiNode *root, BiNode *s) //二叉树的插入算法
if(rootNULL)
root=s;
else if(s->datadata)
lnsertBST(root->ichild,s
else InsertBST(root->rchild, s);
查找技术
最新推荐文章于 2021-12-23 21:15:22 发布