1069. Prufer Code
Time limit: 0.25 second
Memory limit: 8 MB
Memory limit: 8 MB
A tree (i.e. a connected graph without cycles) with vertices is given (
N ≥ 2). Vertices of the tree are numbered by the integers 1,…,
N. A Prufer code for the tree is built as follows: a leaf (a vertex that is incident to the only edge) with a minimal number is taken. Then this vertex and the