All pastes #366858 Raw Edit

Anonymous

public java v1 · immutable
#366858 ·published 2007-02-21 23:29 UTC
rendered paste body
	public int getElementCount() {		if(root == null) {			return 0;		} else if(root != null && root.left == null && root.right == null) {			return 1;		} else {			return getElementCount(root.left)+getElementCount(root.right)+1;		}	}		public int getElementCount(Node currentNode) {		int count=0;		if(currentNode != null && currentNode.left != null) {			getElementCount(currentNode.left);			count++;		} 		if(currentNode != null && currentNode.right != null) {			getElementCount(currentNode.right);			count++;		}		return count;	}