poj1240 Pre-Post-erous!

该博客讨论了在给定先根遍历和后根遍历的情况下,如何确定m叉树的可能性。举例说明了在不同情况下,可能存在多个不同的树结构,这些树具有相同的先序和后序遍历。文章还提到了深度优先搜索(DFS)中的先根遍历和后根遍历的概念,并指出在这种情况下,无法仅凭先序和后序遍历来确定唯一的中序遍历。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

照例先上题目:

1:Pre-Post-erous!
查看 提交 统计 提问
总时间限制: 1000ms 内存限制: 65536kB
描述
We are all familiar with pre-order, in-order and post-order traversals of binary trees. A common problem in data structure classes is to find the pre-order traversal of a binary tree when given the in-order and post-order traversals. Alternatively, you can find the post-order traversal when given the in-order and pre-order. However, in general you cannot determine the in-order traversal of a tree when given its pre-order and post-order traversals. Consider the four binary trees below:

a a a a
/ / \ \
b b b b
/ \ / \
c c c c

All of these trees have the same pre-order and post-order traversals. This phenomenon is not restric

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值