void addup(Tree T, int& v) { if(T != NULL) { v += T->item; addup(T->left); addup(T->right); } } int sum(Tree T) { int v = 0; addup(T, v); return v; }