I would like to calculate the summation of the depths of each node of a Binary Search Tree.
The individual depths of the elements are not already stored.
public class Node { private Node left; private Node right; public int size() { return 1+ (left==null?0:left.size())+ (right==null?0:right.size());} }