CSC403: Tree code: Returns too quickly! [26/29] |
public int size () { if (root == null) return 0; return size (root); } private static int size (Node x) { if (x.left != null) return 1 + size (x.left); if (x.right != null) return 1 + size (x.right); return 1; }
What's wrong with this code?