Jun 8, 2009

Coding: return max depth of binary tree

Coding: return max depth of binary tree
int foo(tree* root)
{
if(!root) return 0;

return 1+max(foo(root->left),foo(root->right));
}

No comments:

Post a Comment