摘要: p1827https://www.luogu.com.cn/problem/P1827 思路 前序遍历的的第一个一定是根节点。在中序遍历中找到该节点,可将中序遍历分成左子树和右子树,重复这个过程,过程中也将后序输出。 代码 #include <bits/stdc++.h> using namespa 阅读全文
posted @ 2025-06-10 21:51 虚拟星辰 阅读(0) 评论(0) 推荐(0)
摘要: 洛谷 P4913 https://www.luogu.com.cn/problem/P4913 思路 对于两个子节点,进行深度搜索 代码 #include <bits/stdc++.h> using namespace std; struct tree{ int l,r; }; tree a[100 阅读全文
posted @ 2025-06-10 19:47 虚拟星辰 阅读(3) 评论(0) 推荐(0)