Advertisement
aaronvan

countEmpty

Aug 19th, 2018
302
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.29 KB | None | 0 0
  1. public int countEmpty() {
  2.     return treeCrawler(overallRoot);
  3. }
  4.  
  5. int count = 1;
  6. private int treeCrawler(IntTreeNode root) {
  7.     if (root == null) {
  8.         return count;
  9.     } else {
  10.        treeCrawler(root.right);
  11.        count++;
  12.        treeCrawler(root.left);
  13.     }
  14.     return count;
  15. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement