Hi,

I wrote the following recursion for finding the distance between a root and a leaf, but am not quite sure how to make it work. Could anyone advise?

Code:int calc_depth(Node* tree, Node* zero) { if (!tree) return 0; if (zero->right || zero->left == tree) return 1; return (zero->right ? calc_depth(tree, zero->right) : calc_depth(tree, zero->left)); }