25_03_10 & 03_11 即使不用栈与队列也要做下去吗,哈基树,你这家伙(二叉树复习)

https://leetcode.cn/problems/symmetric-tree/description/

  • 1.对称二叉树:对称二叉树不是树中心对称而是内侧与外侧镜像对称(左左和右右,左右和右左)

https://leetcode.cn/problems/count-complete-tree-nodes/description/

  • 2.完全二叉树的节点数:除去依赖树的通性解决此问题外,每个完全二叉树可以分解为若干完全二叉子树,每个完全二叉树可以用 size = 2 ^ 树高 求得,完全二叉树判断可以用leftSize == rightSize 判断,最后注意树高 = leftSize +1;

https://leetcode.cn/problems/sum-of-left-leaves/description/

  • 3.左叶子之和:只要对左叶子节点存在与否进行判断就行,其他的交给递归

https://leetcode.cn/problems/path-sum/description/

  • 4.路径总和:狡猾的地方堪称竞赛题(真的不能一次过吗?哈基xu你这家伙)

https://leetcode.cn/problems/construct-binary-tree-from-inorder-and-postorder-traversal/description/

  • 5.中后序构造二叉树:

https://leetcode.cn/problems/maximum-binary-tree/description/

  • 6.最大二叉树:犯了不该犯的错 ,TreeNode *root = new TreeNode(val);初始化指针对象是被允许的

https://leetcode.cn/problems/validate-binary-search-tree/description/

  • 7.验证二叉搜索树:注意pre的含义,迭代和递归法都很精辟

https://leetcode.cn/problems/find-mode-in-binary-search-tree/description/

  • 8.二叉搜索树中的众数:当转化为搜索树后就变成了在升序数组里寻找众数,模拟的情况有两个独立的关键(蛙趣,好难抽离条件),还有如果是普通二叉树呢?

https://leetcode.cn/problems/lowest-common-ancestor-of-a-binary-tree/description/

  • 9.二叉树的最近公共祖先:对左右返回的节点进行判断,然后返回(如果是平衡二叉树呢?)

https://leetcode.cn/problems/delete-node-in-a-bst/

  • 10.删除二叉搜索树的节点:

https://leetcode.cn/problems/convert-sorted-array-to-binary-search-tree/submissions/609216046/

  • 11.将有序数组转化为二叉搜索树:为什么这么简单你也做不出(大哭😭)

!pre 是 pre == nullptr

总结:有点东西,但好像蓝桥杯不怎么考(悲)

posted @ 2025-03-11 21:20  Tongkuly  阅读(18)  评论(0)    收藏  举报