Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw

Comment on

( #3333=superdoc: print w/replies, xml ) Need Help??
This was a fun one. My solution looks quite similiar to Abigail's in structure, but is not nearly so elegant.

I question how they are really going to judge these based on execution time. Its basically a "find the needle in a haystack" problem, but after you've found it, its pretty easy to write a program that finds it faster the next time around.

For instance: Which one of these wins? Are any thrown out for "cheating"?

1: Brute force, try every concievable set of four numbers (loooong time)

2: Using some sort of filtering at each stage, so not every set of four is used (much quicker)

3: Cleverly ordering the stages, so they are done in an optimum order -- perhaps 'THREE->TEN->ONE->SIX'. (slightly quicker, though is uses information gathered in program 2)

4: Brute force, but coded so that the first set of four you try is the correct answer. (even faster!!!)

5: print "$answer"; (clearly the fastest)

Since there is only one haystack and one needle, how do you determine which program "finds" it, and which has already been told where it is....


In reply to Re: (Efficiency Golf) Triangular numbers by blakem
in thread (Efficiency Golf) Triangular numbers by jepri

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 imbibing at the Monastery: (6)
    As of 2018-03-20 20:10 GMT
    Find Nodes?
      Voting Booth?
      When I think of a mole I think of:

      Results (259 votes). Check out past polls.