您的位置: 首页 > 文章 > 二叉树的深度 二叉树的深度 分类: 文章 • 2024-01-07 13:21:52 二叉树深度 dp思想求解,若当前结点非空,则该树的深度为1加左右子树更大的那一支深度,否则返回0。 treeDepth={1+max(leftDepth,rightDepth),Tree≠NULL0,elsetreeDepth={1+max(leftDepth,rightDepth),Tree≠NULL0,else 附code: