Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int countLeaves(Node* root)
- {
- if (!root)
- return 0;
- if (root->right==NULL && root->left==NULL)
- {
- return 1;
- }
- return countLeaves(root->left)+countLeaves(root->right);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement