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