摘要:
这种题边界真的是每次都搞不清楚,我感觉现场估计也写不出来。 #include <bits/stdc++.h> using namespace std; const int N = 1010; int ismirror; int pre[N]; vector<int> post; void dfs(i 阅读全文
posted @ 2024-03-31 11:53
YuKiCheng
阅读(18)
评论(0)
推荐(0)
摘要:
和L2-006是一样的。正常建树,只是在BFS的时候先放右儿子。 L2-006 树的遍历 https://www.cnblogs.com/chengyiyuki/p/18106375 代码: #include <bits/stdc++.h> using namespace std; const in 阅读全文
posted @ 2024-03-31 10:30
YuKiCheng
阅读(35)
评论(0)
推荐(0)
摘要:
先建树,然后遍历数组。 这种方式比较消耗空间,适用于数据量小的情况,如果形成一条链,那将是致命的这个空间。 方法一,数组二叉树 #include <bits/stdc++.h> using namespace std; const int N = 1e5+10; int in[N], post[N] 阅读全文
posted @ 2024-03-31 08:56
YuKiCheng
阅读(21)
评论(0)
推荐(0)