![](https://img-blog.csdnimg.cn/20201014180756918.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
pat甲级
张(⊙﹏⊙)
博主很懒,什么也没留下
展开
-
pat甲级1119Pre- and Post-order Traversals
我们知道前序后序转中序答案是不唯一的 首先必须知道为什么不唯一 中序之所以唯一是因为左右子树分布在根的左右两侧,左边的是左子树,右边的是右子树,但前后序的左右子树分布在同一侧,例如后序序列中当根节点的左侧只有一个节点时,就无法确定他是左节点还是右节点。 可以借鉴中序前序转后序的步骤 1 确定根,确定左子树,确定右子树。 2 在左子树中递归。 3 在右子树中递归。 4 打印当前根。 #include<iostream> #include <vector> using names转载 2020-10-13 09:34:52 · 135 阅读 · 0 评论 -
Pat1084Broken Keyboard
题目 On a broken keyboard, some of the keys are worn out. So when you type some sentences, the characters corresponding to those keys will not appear on screen. Now given a string that you are supposed to type, and the string that you actually type out, plea原创 2020-10-10 19:15:20 · 136 阅读 · 1 评论