Promiscuous Pipelines - Day 5 - 2015-09-05

notes from the fifth day of the promiscuous_pipelines workshop

promiscuous pipelines


Generating all Trees

“(Pruning and grafting.) Representing binary trees as in Algorithm B, design an algorithm that visits all link tables l1…ln and r1…rn in such a way that, between visits, exactly one link changes from j to 0 and another from 0 to j, for some index j. (In other words, every step removes some subtree j from the binary tree and places it elsewhere, preserving preorder).” –Knuth, Generating All Trees: History of Combinatorial Generation.

generating all trees