求二叉树的深度,通常使用这种递归算法. int GetDepth(Node* root) { if (NULL == root) { return 0; } int left_depth = GetDepth(root->left); int right_depth = GetDepth(root->right); return left_depth > right_depth ? left_depth + 1 : right_depth + 1; }