19年春季第四题 PAT甲级 1159 Structure of a Binary Tree(30分)

该博客讨论了如何利用后序和中序遍历来重建二叉树,并针对PAT甲级考试中的1159题进行了解析。博主分享了建树的DFS方法以及如何处理不同类型的结构判断,包括根节点、兄弟节点、父子节点关系等。此外,还提供了相关题目的链接和满分代码资源。

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

汇总贴

2020年3月PAT甲级满分必备刷题技巧

题目

Suppose that all the keys in a binary tree are distinct positive integers. Given the postorder and inorder traversal sequences, a binary tree can be uniquely determined.

Now given a sequence of statements about the structure of the resulting tree, you are supposed to tell if they are correct or not. A statment is one of the following:

  • A is the root
  • A and B are siblings
  • A is the parent of B
  • A is the left child of B
  • A is the right child of B
  • A and B are on the same level
  • It is a full tree

Note:

  • Two nodes are on the same level, means that they have the same depth.
  • full binary tree is a tree in which every node other than the leaves has two children.

Input Specification:

Each input file c

评论 8
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值