谢谢,任何帮助表示赞赏。
答案 0 :(得分:1)
有一个简单的递归算法。以下结果是T
分配的字母集的枚举;由于字母分配了T
或F
,因此很明显如何推导出完整的映射:
# I use ++ for the operation of concatenating lists/sets
# and [X] to produce a list/set consisting of the single element X
enumerate(Q, Accum):
if Q is empty:
return [Accum]
else:
remove the head of Q and put it in Head
return enumerate(Q, Accum) ++
enumerate(children(Head) ++ Q, Accum ++ [Head])
要枚举森林的组合,请致电
enumerate(Roots(Forest), [])