Update binary_trees.cc

This commit is contained in:
Eugene 2017-02-04 17:57:34 +03:00 committed by Aliaksey Kandratsenka
parent cd8586ed6c
commit 86ce69d77f
1 changed files with 5 additions and 3 deletions

View File

@ -34,9 +34,11 @@ struct Node {
Node(Node *l2, int i2, Node *r2) : l(l2), r(r2), i(i2) {}
~Node() { delete l; delete r; }
int check() const {
if (l)
return l->check() + i - r->check();
else return i;
if (l) {
return l->check() + i - r->check();
} else {
return i;
}
}
};