P312: Enumeration of all $k$-ary trees with $n$ vertices

P312: Enumeration of all $k$-ary trees with $n$ vertices
Input:
Two integers $k$ and $n$.
Output:
All $k$-ary trees with $n$ vertices.
Complexity:
$O(1)$ delay.
Comment:
Shifts and loopless algorithm.
Reference:
[Korsh1998] (Bibtex)