Given a sequence $d_1,d_2,\dots,d_n$ be a sequence of positive integers with $\displaystyle \sum^n_{i=1} d_i = 2n-2$. Show that there exists a tree with vertex set $\{ x_1,\dots,x_n\}$ so that $\deg(x_i)=d_i$ for $1\leq i \leq n$.
My attempt:
Suppose there exists a tree $T$ with vertex set $\{x_1,..., x_n\}$ (i.e. $|V(T)|=n$) and let $d_1,..., d_n$ be a sequence of positive integers with $\sum ^{n}_{i=1} d_i = 2n-2$.
\begin{align} \sum_{x \in V(T)} \text{deg}(x_i) &= 2|E(T)|\\ \tag{Since $T$ is a tree} &= 2(|V(T) -1|)\\ &= 2(n-1)\\ \end{align}
Hence, $\displaystyle\sum_{x \in V(T)} \text{deg}(x_i) = 2n-2 = \sum ^{n}_{i=1} d_i$ where deg$(x_i)=d_i$ as required.
Question:
Is this proof valid? Am I allowed to suppose that there exist a tree with $n$ nodes and show that given any tree with $n$ nodes we can have it that $\deg(x_i) = d_i$.