正在加载图片...
@基本操作 查找类 e Root(T ∥求树的根结点 Value(, cur e ∥求当前结点的元素值 o Parent(,cur e ∥求当前结点的双亲结点 G LeftChild(T, cur ∥求当前结点的最左孩子 Rightsibling(T, cur e ∥求当前结点的右兄弟 TreeDepth(T) ∥求树的深度 的 Traverse Tree(T,Ⅴisit0)∥遍历 插入类 ca InitTree(&t ∥初始化置空树 Createtree((&T, definition)∥/按定义构造树 Assign(,curc, value)∥给当前结点赋值 Insertchild(&工,&Pc)∥将以c为根的树插入为结点p的第棵子树 删除类 Delete child(&T,&p,i)∥删除结点p的第裸子树 Deletechild(&T,&p,i)∥删除结点p的第裸棵子树 第6页 Delete child(&T,&p,i)∥删除结点p的第棵子树Data Structure 数 据 结 构—— 第 6 章 树 和 二 叉 树 胡建华 2021/2/19 计算机教研室 第6页 基本操作: • 查 找 类 Root(T) // 求树的根结点 Value(T, cur_e) // 求当前结点的元素值 Parent(T, cur_e) // 求当前结点的双亲结点 LeftChild(T, cur_e) // 求当前结点的最左孩子 RightSibling(T, cur_e) // 求当前结点的右兄弟 TreeDepth(T) // 求树的深度 TraverseTree( T, Visit() ) // 遍历 • 插 入 类 InitTree(&T) // 初始化置空树 CreateTree(&T, definition) // 按定义构造树 Assign(T, cur_e, value) // 给当前结点赋值 InsertChild(&T, &p, i, c) // 将以c为根的树插入为结点p的第i棵子树 • 删 除 类 DeleteChild(&T, &p, i) // 删除结点p的第i棵子树 DeleteChild(&T, &p, i) // 删除结点p的第i棵子树 DeleteChild(&T, &p, i) // 删除结点p的第i棵子树
<<向上翻页向下翻页>>
©2008-现在 cucdc.com 高等教育资讯网 版权所有