Description: Robson遍历改进版:
这个课程设计的目的是进行一个罗布森遍历.
编写和测试的“修改”罗布森遍历程序使用链表代表的二叉树。
这一修改后的版本与原始的不同之处在于罗布森以一个节点的左指针指向左子树;现在修改版是反向。也就是说,当一个节点的左(右)子树正在走过,它的左(右)指针将指向其右(左)子树。在遍历,当一个节点访问,输出
每个栈的内容,它的右左指针。如此这样处理每个栈内元素。-Robson Traversal
Write and test a "modified" Robson Traversal program that uses the linked representation of the trees.
This modified version differs from the Robson only in that the pointers to a node s predecessor should
now be as in the Linked Inversion Traversal. That is, when a node s left(right) subtree is being traversed,
its left(right) pointer will point to its predecessor. During the traversal, when a node is visited, output
for each "stack entry, its info value and the info value of its left and right successors. This means, first,
output the number of the node Top points to, and then the number that that node s left and right pointers
point to. Then, output the number of the node that Stack points to,and then the numbers that that node s left
and right pointers point to. Do this for each node on the "stack" Platform: |
Size: 3072 |
Author:hunter |
Hits: