Inputs: vector q below and c = 0.8
Here is how the vectors r, X, and Y are computed, resulting in 4 maximal regions of q that each have density at least 0.8 of 1's:
0 1 1 1 0 1 1 1 1 1 0 1 1 0 1 1 1 0 1 1 0 1 q -.8 .2 .2 .2 -.8 .2 .2 .2 .2 .2 -.8 .2 .2 -.8 .2 .2 .2 -.8 .2 .2 -.8 .2 q-.8 0.0 -.8 -.6 -.4 -.2 -1.0 -.8 -.6 -.4 -.2 0.0 -.8 -.6 -.4 -1.2 -1.0 -.8 -.6 -1.4 -1.2 -1.0 -1.8 -1.6 r 0.0 -.8 -.8 -.8 -.8 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.2 -1.2 -1.2 -1.2 -1.4 -1.4 -1.4 -1.8 -1.8 X 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 -.4 -.4 -.4 -.6 -.6 -.6 -.6 -1.0 -1.0 -1.0 -1.6 -1.6 Y ________________________________________________ 8/10 = 0.8 ______________________________________________________________________________ 13/16 = 0.8125 _________________________________________________________________________ 12/15 = 0.8 ___ 1.0