文件名称:SPECULAR-REFLECTION-OF-A-TREE.cpp
介绍说明--下载内容均来自于网络,请自行研究使用
一棵树的镜面映射指的是对于树中的每个结点,都将其子结点反序。例如,对左边的树,镜面映射后变成右边这棵树。
a a
/ | \ / | b c f ===> f c b
/ \ / d e e d
我们在输入输出一棵树的时候,常常会把树转换成对应的二叉树,而且对该二叉树中只有单个子结点的分支结点补充一个虚子结点“$”,形成“伪满二叉树”。 例如,对下图左边的树,得到下图右边的伪满二叉树
a a
/ | \ / b c f ===> b $
/ \ / d e $ c
/ d f
/ $ e
然后对这棵二叉树进行前序遍历,如果是内部结点则标记为0,如果是叶结点则标记为1,而且虚结点也输出。
现在我们将一棵树以“伪满二叉树”的形式输入,要求输出这棵树的镜面映射的宽度优先遍历序列。 -A tree mirror mapping refers to each node in the tree, all its child nodes in reverse order. For example, after the tree on the left, to the right of the mirror is mapped into a tree. aa/| \/| \ bcf ===> fcb/\/\ deed us the input and output of a tree when the tree will often be converted into the corresponding binary tree, and a branch of the binary tree, only a single child node add a virtual child node node " $" , the formation of " Manchukuo binary tree." For example, the following figure on the left of the tree to get to the right of the figure below Manchukuo binary aa/| \/\ bcf ===> b $/\/\ de $ c/\ df/\ $ e and then the tree binary tree former preorder, if it is an internal node is labeled 0, if it is a leaf node labeled 1, and virtual nodes are output. Now we will one tree to the " Manchukuo binary" form input, output requirements specular mapping tree breadth-first traversal sequence.
a a
/ | \ / | b c f ===> f c b
/ \ / d e e d
我们在输入输出一棵树的时候,常常会把树转换成对应的二叉树,而且对该二叉树中只有单个子结点的分支结点补充一个虚子结点“$”,形成“伪满二叉树”。 例如,对下图左边的树,得到下图右边的伪满二叉树
a a
/ | \ / b c f ===> b $
/ \ / d e $ c
/ d f
/ $ e
然后对这棵二叉树进行前序遍历,如果是内部结点则标记为0,如果是叶结点则标记为1,而且虚结点也输出。
现在我们将一棵树以“伪满二叉树”的形式输入,要求输出这棵树的镜面映射的宽度优先遍历序列。 -A tree mirror mapping refers to each node in the tree, all its child nodes in reverse order. For example, after the tree on the left, to the right of the mirror is mapped into a tree. aa/| \/| \ bcf ===> fcb/\/\ deed us the input and output of a tree when the tree will often be converted into the corresponding binary tree, and a branch of the binary tree, only a single child node add a virtual child node node " $" , the formation of " Manchukuo binary tree." For example, the following figure on the left of the tree to get to the right of the figure below Manchukuo binary aa/| \/\ bcf ===> b $/\/\ de $ c/\ df/\ $ e and then the tree binary tree former preorder, if it is an internal node is labeled 0, if it is a leaf node labeled 1, and virtual nodes are output. Now we will one tree to the " Manchukuo binary" form input, output requirements specular mapping tree breadth-first traversal sequence.
(系统自动生成,下载前可以参看下载内容)
下载文件列表
SPECULAR REFLECTION OF A TREE.cpp
__MACOSX
........\._SPECULAR REFLECTION OF A TREE.cpp