All pastes #367023 Raw Edit

Untitled

public text v1 · immutable
#367023 ·published 2007-02-22 01:49 UTC
rendered paste body
	public int getTreeHeight() {
		return 1+max(getTreeHeight(root.right),getTreeHeight(root.left));
	}
	
	private int getTreeHeight(Node currentNode) {
		if(currentNode == null) {
			return 0;
		} else {
			return max(getTreeHeight(currentNode.left),getTreeHeight(currentNode.right));
		}
	}