[Python-ideas] Powerset
Pål Grønås Drange
paal.drange at gmail.com
Tue Oct 16 02:24:25 EDT 2018
> Is there a name for an iteration of the powerset which is more useful for
binary search? I.e. instead of starting with null set, start with the
"middle" ( r/2 ).
>
> Maybe a bit OT, but is there a name for such a combinatorial search?
Not that I know of, especially since this has the unfortunate drawback that
you're going through the largest part of the search space first. Usually, I
find that I want to do the opposite from this; go from both ends
simultaneously.
Hasan, if you recall that the powerset is just
`yield from S choose k for k from 0 to |S|+1`,
you see that that is exactly the implementation in the examples page.
Best regards,
Pål GD
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20181016/11bf598d/attachment.html>
More information about the Python-ideas
mailing list