int getDeepth(TreeNode *root, int value)
{
if (root == NULL)
return -1;
if (root->value = value)
return 1;
int deepth = getDeepth(root->left, value, parentDeepth+1);
if (deepth >= 1)
return deepth + 1;
deepth = getDeepth(root->right, value, parentDeepth+1);
if (deepth >= 1)
return deepth + 1;
return -1;
} |