added preconditions for binary tree construction