文件名称:陈越、何钦铭-数据结构作业11:Tree Traversals Again二叉树非递归遍历/栈遍历
文件大小:4KB
文件格式:JAVA
更新时间:2021-05-08 06:07:49
陈越 数据结构 Tree Traversals Again
An inorder binary tree traversal can be implemented in a non-recursive way with a stack. For example, suppose that when a 6-node binary tree (with the keys numbered from 1 to 6) is traversed, the stack operations are: push(1); push(2); push(3); pop(); pop(); push(4); pop(); pop(); push(5); push(6); pop(); pop(). Then a unique binary tree (shown in Figure 1) can be generated from this sequence of operations. Your task is to give the postorder traversal sequence of this tree.