http://www.perlmonks.org?node_id=929382


in reply to Re: bit-vector > global minimum
in thread bit-vector > global minimum

Choroba,

This algorithm you suggest would fail on a bit vector of 15 1s followed by 5 zeroes.

David.

Replies are listed 'Best First'.
Re^3: bit-vector > global minimum
by choroba (Cardinal) on Oct 03, 2011 at 17:26 UTC
    I updated the algorithm, an important part was missing from the post (silly me). It should work now:
    1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 - - 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 - - - - 0 0 0 1 1 1 1 1 1 1 1 1 1 1 - - - - - - 0 0 1 1 1 1 1 1 1 1 1 1 - - - - - - - - 0 1 1 1 1 1 1 1 1 1 - - - - - - - - - - ^ minimum