重练算法(代码随想录版) day14 - 二叉树part2

今日刷题量:7
当前刷题总量:73
Easy: 43
Mid: 28
Hard: 2

Day13
基础理论
主要掌握递归法的三个步骤来解题
1.确定递归函数的参数和返回值
2.确定终止条件
3.确定单层递归的逻辑
对于二叉树的题,也要想明白到底是用的哪种遍历方式

补充易混淆概念:
二叉树节点的深度:指从根节点到该节点的最长简单路径边的条数或者节点数(取决于深度从0开始还是从1开始)
二叉树节点的高度:指从该节点到叶子节点的最长简单路径边的条数或者节点数(取决于高度从0开始还是从1开始)

练习题目
226.翻转二叉树(easy):https://leetcode.cn/problems/invert-binary-tree/description/
101. 对称二叉树 (easy):https://leetcode.cn/problems/symmetric-tree/description/
589.N叉树的前序遍历(easy):https://leetcode.cn/problems/n-ary-tree-preorder-traversal/description/
590.N叉树的后序遍历(easy):https://leetcode.cn/problems/n-ary-tree-postorder-traversal/description/
100.相同的数(easy):https://leetcode.cn/problems/same-tree/description/
572.另一棵树的子树(easy):https://leetcode.cn/problems/subtree-of-another-tree/description/
559.N叉树的最大深度(easy):https://leetcode.cn/problems/maximum-depth-of-n-ary-tree/description/

posted @ 2025-11-18 21:10  GengarF  阅读(2)  评论(0)    收藏  举报