i have come across this code for calculating the depth of a binary tree.
int maxDepth(Node *&temp)
if(temp == NULL)
int lchild = maxDepth(temp->left);
int rchild = maxDepth(temp->right);
if(lchild <= rchild) 1
return rchild+1; 2
return lchild+1; 4
in these recursive calls i am really clue less about how the statements i numbered from 1 to 4 would be executed...in every recursive call...???
lets temp has left depth of 3 and right depth of 100 then...in last 97 recursive calls max(temp->left) would be doing...????? how these recursive mechanism work here...plz dont answer this vaguely....i want to know specifically how these left node and right node recursive calls are co-ordinating with each other????
my exaxt question is ...how it is dealt when we make two recursive calls as we did here (int lchild = maxDepth(temp->left);
int rchild = maxDepth(temp->right )those require different number of transactions... to compute????