摘要
根据普通树与其对应二叉树表示法在遍历序列上的特点,利用堆栈实现普通树深度优先遍历的非递归算法,利用队列实现普通树广度优先遍历的非递归算法。同时给出对普通树从输入到输出及三种遍历算法实现的完整的C++语言程序。
According to common tree and its corresponding binary-tree representation in traverse sequence on characteristics,this paper uses the stack to realize the recursion algorithm about common tree depth-first traverse and the queue to realize the recursion algorithm about common tree breadth first traverse.It also supplies us with complete C++language program which from the input to the output and realization of three kinds of traversing algorithm to common tree.
出处
《信息技术》
2011年第3期122-124,共3页
Information Technology
关键词
树
树的二叉树表示法
深度优先遍历
广度优先遍历
tree
binary-tree representation of tree
depth-first traverse
breadth first traverse