Arnaud Delobelle wrote: > more simply: > > def clusters(l): > if len(l) == 1: > yield l[0] > return > for i in range(1, len(l)): > for left in clusters(l[:i]): > for right in clusters(l[i:]): > yield (left, right) > > That would give all solutions without duplicates. In fact, this is > simply finding all full binary trees which order l.
Easy, now that I see it ;) -- http://mail.python.org/mailman/listinfo/python-list