- #1
evinda
Gold Member
MHB
- 3,836
- 0
Hi! (Wave)
I want to write an algorithm, that counts the sum of the keys of the nodes of a binary tree, without the use of globals and statics.
That's what I have tried:
Could you tell me if it is right? (Thinking)
I want to write an algorithm, that counts the sum of the keys of the nodes of a binary tree, without the use of globals and statics.
That's what I have tried:
Code:
S(NODE *P){
if (P==NULL) return 0;
int m=P->data+S(P->left);
int n=m+S(P->right);
return n;
Could you tell me if it is right? (Thinking)
Last edited: