View Single Post
  #5 (permalink)  
Old 05-15-2008, 11:23 AM
WingedPanther's Avatar   
WingedPanther WingedPanther is offline
Super Moderator
 
Join Date: Jul 2006
Age: 35
Posts: 2,530
Last Blog:
wxWidgets is NOT code ...
Credits: 911
Rep Power: 28
WingedPanther is a jewel in the roughWingedPanther is a jewel in the roughWingedPanther is a jewel in the roughWingedPanther is a jewel in the rough
Default Re: Generating all sequences of 1s and 0s of length 30

First issue: you are searching through a space of 2^30 or 1,073,741,824 strings.
Second issue: your "invalid" strings consist of
2^1 3 digit strings
2^2 6 digit strings
2^3 9 digit strings
2^4 12 digit strings
2^5 15 digit strings
...
2^10 30 digit strings
This means you have 2^11-2 potential substrings to check for each of your strings. Of course, some of the longer strings are invalid because of the shorter strings (00 00 00 contains 000, etc).

The two options I can see are:
1) build a minimal list of invalid substrings, and for each candidate, check for the presence of all the invalid substrings. This may be prohibitively large.
2) for each string, loop through it grabbing 1, then 2, then 3, etc characters, checking to see if it is the basis of an invalid string.
__________________
CodeCall Blog | CodeCall Wiki | Shareware | Linux Forum
Chat with other CodeCall members on IRC; connect to irc.codecall.net and join #codecall
Reply With Quote

Sponsored Links