Advertisement
Guest User

Untitled

a guest
Aug 20th, 2019
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.19 KB | None | 0 0
  1. int countLeaves(Node* root)
  2. {
  3. if (!root)
  4. return 0;
  5. if (root->right==NULL && root->left==NULL)
  6. {
  7. return 1;
  8. }
  9. return countLeaves(root->left)+countLeaves(root->right);
  10. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement