【例3-5】扩展二叉树
You cannot submit for this problem because the contest is ended. You can click "Open in Problem Set" to view this problem in normal mode.
【题目描述】
由于先序、中序和后序序列中的任一个都不能唯一确定一棵二叉树,所以对二叉树做如下处理,将二叉树的空结点用·补齐,如图所示。我们把这样处理后的二叉树称为原二叉树的扩展二叉树,扩展二叉树的先序和后序序列能唯一确定其二叉树。
现给出扩展二叉树的先序序列,要求输出其中序和后序序列。
【输入】
扩展二叉树的先序序列。
【输出】
输出其中序和后序序列。
【输入样例】
ABD..EF..G..C..
【输出样例】
DBFEGAC
DFGEBCA
【来源】
一本通在线评测
C24暑假末竞速赛——数据结构专题
- Status
- Done
- Rule
- Ledo
- Problem
- 5
- Start at
- 2025-8-26 16:45
- End at
- 2025-8-27 22:45
- Duration
- 4 hour(s)
- Host
- Partic.
- 6