{1, 2, ..., n} מעל א"ב n-2 קלט: מילה באורך
V = {1, 2, ..., n} פלט: עץ עם צמתים:
For i=1 to n-2 do
Let j be the least vertex for which d(j) = 1.
Construct an edge j – ai,
d(j) 0 and d(ai) d(ai) – l.
Construct an edge between
the two vertices whose degree is 1