Can anyone help me understand this function?Code:int depth(cvor *root)
{
int left, right;
if(root) {
left = depth(root->left);
right = depth(root->right);
return 1 + (left > right ? left : right);
}
return 0;
}
I tried writing it down on paper but i just cant visualize how this works....
Should i try finding an animation of this on the internet and learning it like that? Or just write all calls to paper and try to understand how it works...