二叉排序树的存储结构定义为以下类型
typedef int KeyType;
typedef struct node{
KeyType key;//关键字项
InfoType otherinfo;//其他数据项
struct node Ichild, rchild//左右孩子指针
BSTNode, *BSTree;
阅读算法f33,并回答问题:
(1)对如题图所示的二叉排序树T,写出33(T,8)返回的指针所指结点的关键字
(2)在哪些情况下算法f33返回空指针?
(3)简述算法f33的功能。
BSTNode f333(BSTree, KeyType)
{BSTNode *p:
if (T==NULL) return NULL:
p=f33(T->lchild, x);
if (p!-NULL) return pi
if (T->key >x) return T:
return f33(T->rchild, x);
}
(1)
(2)
(3)
订单号:
遇到问题请联系在线客服
订单号:
遇到问题请联系在线客服