网站介绍:文章浏览阅读3.8k次。树的高度是从当前节点到叶子结点的路径双重递归的求法:class Solution {public: //递归写法 int maxDepth(TreeNode* root) { if(root==NULL){ return 0; } int l=maxDepth(root->left)+1; int r=maxDepth(root->right)+1; return l&g_如何求树中点的深度
- 链接地址:https://blog.csdn.net/weixin_44118034/article/details/109321295
- 链接标题:知识点1:节点(树)的高度(深度)求法_如何求树中点的深度-CSDN博客
- 所属网站:blog.csdn.net
- 被收藏次数:5749
- 网站标签:如何求树中点的深度