Well I'm down to the last function of my program and I'm done. I've hit another stump that I can't seem to fix on my own.
int Tree::InternalPathLength(Node * r, int value)
{
if(r->left == NULL && r->right == NULL)
{
return 0;
}
return value + InternalPathLength(r->left, value+1) +
InternalPathLength(r->right, value+1);
}
I feel like i'm close to the solution, but i know i'm missing something. I think it's another if statement and i've tried different combinations but i end up getting a crashed program or 0 for the answer.
Any suggestions or help would be much appreciated ! thanks!