# What is the name of this size method calculating the size of a node?

My confusion is that if the recursive call calls the left nodes, and then adds with the right nodes, how are the nodes that are to to right of the left nodes and vice versa being called?

int size (BinaryNode t) {
if (t == null)
return 0;
else
return 1 + size(t.left) + size(t.right);
}

• size returns the number of nodes in t; proof by induction. – Raphael Feb 28 '15 at 11:29

Remember that to get the actual value of size(t.left), you have to evaluate the method size at the node t.left, i.e. assuming t.left has left and right children the algorithm with call size((t.left).left) and size((t.left).right).