The problem is to create boolean vector of length n
with k
true
entries (and n-k
false
entries) well dispersed in the vector.
If k = 5
and n = 8
manually created solutions are [1 0 1 1 0 1 0 1]
or [1 0 1 0 1 0 1 1]
etc.
An example for a vector with entries that are not well dispersed would be [1 1 1 1 1 0 0 0 0]
.
A possible criterium for "well-dispersedness" is having alternating blocks of zeros and ones of roughly the same length - specifically with one-blocks of size floor(n/k)
or floor(n/k) + 1
and zero-blocks of size floor(n/(n-k))
or floor(n/(n-k)) + 1
.
How to create such a vector?