I was trying to make a D-ary Huffman tree for the probabilities $(\frac{1}{21},\frac{2}{21},\frac{3}{21},\frac{4}{21},\frac{5}{21},\frac{6}{21})$
in the case of the threnary tree, grouping the tree less probables and going up I end with a non optimal code $\left(022,021,020,00,01,1 \right)$ But since I have non a code than starts with $2$ I could modify so I have a optimal code $(021,020,00,01,1,2)$ I did ths using inspection. But I was wondering is other method of construction from when the tree is not binary.
The construction of the $3-$ary Huffman tree, in each step merges $3$ symbols into one, i.e a reduction of $2$ symbols; and we want the process to end in a single node. Hence the number of symbols in each step, and in particular at the beginning, must be odd. (In general, for a $D-$ary code we want a number of symbols of the form $1+m(D-1)$, with $m \in \mathbb{N}$).
Here we have $6$ symbols. Then, we should add a dummy symbol with zero probability to start the tree construction.
BTW: this is mentioned in Cover & Thomas' textbook, example 5.6.3, page 119.