文件名称:树的问题(生成)
介绍说明--下载内容均来自于网络,请自行研究使用
ADT BinaryTree 的实现及验证程序采用的主要数据结构:二叉树、栈、队算法思想:1、 先序建树、输出树、后序遍历用递归方法。性能分析:O( n )2、 先序遍历、中序遍历:性能分析:O( n )(1) 若遇到新节点非空则先入栈,然后访问其左子树。(2) 若为空则将栈顶结点出栈,访问其右子树。(3) 循环1、2直到栈为空且无节点可入栈。先序与中序的区别是:先序在入栈时访问节点,中序在出栈时访问节点。3、 层遍历:性能分析:O( n )(1) 根节点入队(2) 节点出队并访问(3) 若节点有左孩子,则左孩子入队;有右孩子,则右孩子入队。(4) 重复2、3直到队列为空。4、 线索树:算法与先序遍历、中序遍历一样,只是将访问节点的Visit函数改为连接前驱与后继的操作。性能分析:O( -BinaryTree ADT Implementation and certification procedures used in the main data structure : binary tree, stack, algorithms team thinking : a first order contribution, the output tree, after preorder using recursive method. Performance Analysis : O (n) 2, preorder, the preorder : Performance Analysis : O (n) (1) If there is a new non-empty nodes were first pushed and then left to visit their son tree. (2) if the empty Zhanding node will stack up, visit their right subtrees. (3) 1,2 cycle until the stack is empty with no node can be pushed. First sequence with the sequence difference : Push the first sequence to visit nodes, which stack up in order to visit nodes. 3, the layer traverse : Performance Analysis : O (n) (1) nodes into Force (2) nodes and the team's visit (3) if the nodes ar
(系统自动生成,下载前可以参看下载内容)
下载文件列表
tree
....\tree.c
....\TREEMAIN.C
....\tree.c
....\TREEMAIN.C