Advertisement
ringalo

countLeaves

Jun 26th, 2017
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.26 KB | None | 0 0
  1. int countLeaves() {
  2.             if( this.left == null && this.right == null ) {
  3.                 return 1;
  4.             } else {
  5.                 return (left != null ? left.countLeaves() : 0) + (right != null ? right.countLeaves() : 0);
  6.             }
  7.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement