int hasSum(struct node* root, int sum) { if(root == NULL) return (sum == 0); sum = sum - root->data; return hasSum(root->left, sum) || hasSum(root->right, sum); }
No comments:
Post a Comment