MathOverflow will be down for maintenance for approximately 3 hours, starting Monday evening (06/24/2013) at approximately 9:00 PM Eastern time (UTC-4).
-1

So my problem is the following:

Assume that you have a vector of bits:

A = [b1 b2 ... bN]

I want to find an efficient way to produce all the possible A vectors that satisfy the following properties:

-> b1 = bN = 1

-> at least one bit is zero

-> only the following patterns are acceptable :

[11...1 0...0 1...1]

,i.e. all the zeros are gathered together (no 1 in between).

I am trying to avoid the ''brute force'' solution of producing all the possible vectors for some N and then pick the acceptable ones, because I may have to deal with N around 30 or more.

If anyone has any idea or hint it would be greatly appreciated.

Cheers!

Chris

flag
This is not a research-level question, so I'm voting to close. As a hint: Any vector of the sort you want is determined by the position of its first and last zeros. – Andreas Blass Jun 24 2011 at 13:28
Two nested for loops will do the job. This question is neither research-level nor mathematics, please see the faq. – Emil Jeřábek Jun 24 2011 at 13:28
Also, one for loop and some decoding can do it. Gerhard "Email Me About System Design" Paseman, 2011.06.24 – Gerhard Paseman Jun 24 2011 at 16:48

closed as off topic by Douglas Zare, Emil Jeřábek, Andreas Blass, Bruce Westbury, Andres Caicedo Jun 24 2011 at 14:00

Browse other questions tagged or ask your own question.