The whole question is set out in the title. The degree of variation is not difficult to determine - 1 or 2, there are no other options, but how to write it in c ++? The implementation of the tree is as follows:
struct tree { int inf; tree*right; tree*left; }; tree * node(int x) { tree*n = new tree; n->inf; n->left = n->right = NULL; return n; } void create(tree *&tr, int n) { int x; if (n > 0) { cin >> x; tr = node(x); int nl = n / 2; int nr = n - nl - 1; create(tr->left, nl); create(tr->right, nr); } }