在这个定义中,subTree函数会起作用吗?我有点困惑。现在,如果树中的节点包含字符串"s“,则可以将带有字符串"s”的叶子视为子树。data Tree = Leaf String | Node Tree String Tree
subTree (Leaf s) t =inTree s tsubTree (Node t1 s
)
if self.left: yield from self.left.subtree_iter() if self.right: yield from self.right.subtree_iter() def subtree_first(self):
if self.left: return self.left.subtree_fir
relates a tree and the numbe of nodes in that tree(order)tree_order(tree(_, Left_Subtree, Right_Subtree), Order) :- Order #= Left_Subtree_Order + Right_Subtree_Order +1,
tree_order(Left_Subtree, Left_S