I have the Prufer Code $(6,2,2,6,2,5,10,9,9)$.
I want to build the corresponding tree.
My algorithm:
1) Tree = $\{\}$, code = $(6,2,2,6,2,5,10,9,9)$, count = $(1,2,3,4,5,6,7,8,9,10,11)$
2) Tree =$\{(2,6)\}$, code = $(2,2,6,2,5,10,9,9)$, count = $(1,3,4,5,6,7,8,9,10,11)$
3) Tree =$\{(2,6), (2,3)\}$, code = $(2,6,2,5,10,9,9)$, count = $(1,4,5,6,7,8,9,10,11)$
4) Tree =$\{(2,6), (2,3), (2,4)\}$, code = $(6,2,5,10,9,9)$, count = $(1,5,6,7,8,9,10,11)$
5) Tree =$\{(2,6), (2,3), (2,4),(5,6)\}$, code = $(2,5,10,9,9)$, count = $(1,6,7,8,9,10,11)$
6) Tree =$\{(2,6), (2,3), (2,4),(5,6), (2,6)\}$, code = $(5,10,9,9)$, count = $(1,7,8,9,10,11)$
7) Tree =$\{(2,6), (2,3), (2,4),(5,6), (2,6),(5,7)\}$, code = $(10,9,9)$, count = $(1,8,9,10,11)$
8) Tree =$\{(2,6), (2,3), (2,4),(5,6), (2,6),(5,7),(8,10)\}$, code = $(9,9)$, count = $(1,9,10,11)$
9) Tree =$\{(2,6), (2,3), (2,4),(5,6), (2,6),(5,7),(8,10),(9,10)\}$, code = $(9)$, count = $(1,9,11)$
10) Tree =$\{(2,6), (2,3), (2,4),(5,6), (2,6),(5,7),(8,10),(9,10), (9,11)\}$, code = $()$, count = $(1,9)$
11) Tree = $\{(2,6), (2,3), (2,4),(5,6), (2,6),(5,7),(8,10),(9,10), (9,11),(1,9)\}$
Is my solution correct?



I would suggest it goes like this:
Let us first count the degrees of the nodes in the Prüfer Code, ie. count how many times they appear:
$$ \begin{array}{c|c} \text{node}&6&2&5&10&9\\ \hline \text{degree}&2&3&1&1&2 \end{array} $$
Thus $6$ has to have appeared twice as a neighbor of a removed vertex before it could have been removed itself. Similarly $2$ must have three leaves that are removed before it itself becomes a removable leave.
The vertices that can be removed, the free nodes, must be those NOT in the Prüfer Code.
Thus:
And finally we must connect the remaining two, namely
(9,11).