数据结构第六章来树和二叉树.ppt

数据结构第六章来树和二叉树

(5)DeleteL(bt,Parent)在二叉树bt中删除结点Parent的左子树 (6) DeleteR(bt,Parent)在二叉树bt中删除结点Parent的右子树 (7)Search(bt,x)在二叉树bt中查找数据元素x (8)Traverse(bt)按某种方式遍历二叉树 实现算法 (1)Init(bt) int Init( BiTree bt) { if((bt =(BiTree)malloc(sizeof(BiTNode)) ==NULL) return 0; bt-Lchild=NULL; bt-rchild=NULL; return 1; } (2)Create(x,lbt,rbt) BiTree Create(x,lbt,rbt) { BiTree p; if((bt =(BiTree)malloc(sizeof(BiTNode)) ==NULL) return NULL; p-data = x; p-lchild=lbt; p-rchild=rbt; return p; } (3)InsertL(x, Parent) BiTree InsertL(x, Parent) { BiTree p; if(Parent==NULL) re

文档评论(0)

1亿VIP精品文档

相关文档