I'm suppose to add up all the number that are in a node of a binary tree.

Is this correct???

This is just the algorithm:::

static int weight(BinaryTree t, Node v)
if t.size == 0 then //if BinaryTree t is an empty tree
return 0
else
 
if t.hasLeft(v) then /** if Node v of BinaryTree t doesn't have a left children, it means Node v is an external node. */
return v.element
else
return weight(t, t.left(v)) + weight(t, t.right(v))