🔥码云GVP开源项目 12k star Uniapp+ElementUI 功能强大 支持多语言、二开方便! 广告
## 二叉树的深度 ```java int length(Node root) { int depth1; int depth2; if(root == ) return 0; // 左子树的深度 depth1 = length(root.right); // 右子树的深度 depth2 = length(root.left); if(depth1>depth2) return depth1+1; else return depth2+1; } ```