1
$\begingroup$

I have a set of 1000 items and want to go through all subsets of size 499 of these elements.

In python library I will use “yield” function so I generate the sets rather than cause overflow, but I am wondering how long will I have to wait to get each subset (and perform no operations for the time being) will it be days? How many?

$\endgroup$
4
  • $\begingroup$ This will take almost certainly a long time. But without knowing your machine specs and code there is no way to give a good estimate. $\endgroup$
    – ttnick
    Commented Sep 11 at 12:23
  • $\begingroup$ We're not a coding site, so questions about what Python will do is likely off-topic here. If you want to ask about some concept or algorithm, or request an algorithm that can generate subsets with low delay between each subsequent subset, that is on-topic here. $\endgroup$
    – D.W.
    Commented Sep 11 at 18:16
  • $\begingroup$ You are probably in a position and able to assess this analytically. Then again, experimenting may be nore fun and no less instructive: For how big a set does it take 5 seconds to generate all subsets half the size-1? How much time for sets 2 smaller, 2, 4, 6… bigger? Can you fit a function? $\endgroup$
    – greybeard
    Commented Sep 12 at 20:20
  • $\begingroup$ There are very roughly about 2^1000 / 1000 such subsets, so you won’t finish within the lifetime of the universe enumerating the subsets. $\endgroup$
    – gnasher729
    Commented Sep 21 at 19:30

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.