64,648
社区成员
发帖
与我相关
我的任务
分享
BiTree find(BiTree root, Type value)
{
if (root == NULL) return NULL;
if (root->value == value) return root;
BiTree ans = find(root->left, value);
if (ans) return ans;
return find(root->right, value);
}
int depth(BiTree root)
{
if (root == NULL) return 0;
int l = depth(root->left);
int r = depth(root->right);
return max(l, r)+1;
}
depth(find(root, value));
为所求