public int depthOfNode(treeNode node, HashMap<treeNode, Integer> nodesDepth) {
		count++;
		if (node == null)
			return 0;

		// already calculated.
		if (nodesDepth.containsKey(node))
			return nodesDepth.get(node);

		int leftDepth = depthOfNode(node.leftLeaf, nodesDepth);
		int rightDepth = depthOfNode(node.rightLeaf, nodesDepth);

		int nodeDepth = (leftDepth >= rightDepth ? leftDepth + 1
				: rightDepth + 1);
		// System.out.println("Depth of node "+node.value +":"+nodeDepth);
		// put into map
		nodesDepth.put(node, new Integer(nodeDepth));
		return nodeDepth;
	}