ok i have some code here that tells me how to find the depth
Code:
int depth(NODE *node)
{
int left = -1; // clear left
int right = -1; // and right
if( node!= 0 ) // if the left child exists
left = depth(node->left); // update the left depth
if( node!= 0 ) // if the right child exists
right = depth(node->right); // update the right depth
if( left > right ) // if left is larger than
return left+1; // right, return left + 1
return right+1; // else return right + 1
}
I have an array defined globally to keep track of how many words I find on each level. I don't know how to manipulate this code to store the numbers. Can anyone help?