P163: Enumeration of all ordered trees with $n$ vertices and $k$ leaves

P163: Enumeration of all ordered trees with $n$ vertices and $k$ leaves
Input:
Integers $n$ and $k$.
Output:
All ordered trees with $n$ vertices and $k$ leaves.
Complexity:
$O(1)$ delay and $O(n)$ space.
Comment:
Reference:
[Yamanaka2009a] (Bibtex)