Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation

Comment on

( #3333=superdoc: print w/replies, xml ) Need Help??
I don't think that I understand the question. Help me out...because this just seems too simple. Successive table look-ups that are combined together - no input vector bit is used more than once.

I will proffer that O(n) notation may not be the best for describing what is efficient or not. In an abstract sense, the number of operations is paramount. In an implementation, how fast/slow each operation is also matters. Sometimes using more really fast operations is "better" than fewer slow operations.

Re: bit-vector > global minimum sounded pretty good to me. It appears to me that every bit in the bit vector will need to be examined. If this is not done bit by bit, then why not do it in groups of bits as a look-up table?

A binary search tree that takes into account all possible variations of a really, really long vector could be huge!

If I do this 8 bits at a time, then there is a table of 512 possible results and I think the result can be calculated one look-up at time.
bits 2,5 are lowest min values, that whole vector '10010010' could be an index into an array of struct that lists the values of 2,5. I think there needs to be an extra test of '0' at the end of the 8 bits and a way to propagate results to the next 8 bits to keep track of the "best" so far. The implementation may work better if bits are inverted before the table look-up. And I think that probably one more bit needs to be added to the look-up table to help with a "stitch" of the previous result together with current result is required.

I am thinking that a static table would suffice. A dynamic table would perhaps be better (shorter)?

In reply to Re^5: bit-vector > global minimum by Marshall
in thread bit-vector > global minimum by baxy77bax

Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":

  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?

    What's my password?
    Create A New User
    and all is quiet...

    How do I use this? | Other CB clients
    Other Users?
    Others musing on the Monastery: (9)
    As of 2018-03-21 17:26 GMT
    Find Nodes?
      Voting Booth?
      When I think of a mole I think of:

      Results (270 votes). Check out past polls.