Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Comment on

( #3333=superdoc: print w/ replies, xml ) Need Help??
By inversely proportional, I meant that the number of questions asked to identify an animal (Q) multiplied by how many times the animal is chosen (C) should be constant. If a goat appears a hundred times more often than a unicorn then it should take a hundred times more questions to identify the unicorn than the goat.

In roboticus' example, which you seem to be endorsing, this is the tree produced:

Q ___________________/ \___________________ / \ Q __________________Q / \ / \ Q fish Q _________Q / \ / \ / +\ __________Q cow dog cat Q + Q / \ / \ +/ \ Q Q Q wolf sheep + horse / \ / \ / \ walrus badger seal Q________________ wolverine frog / \ Q Q / \ / \ Q hampster ocolot Q / \ / \ pegasus Q gerbil platypus / \ axolotl unicorn

The fish with a frequency of 150 requires 2 questions; the unicorn with a frequency of 1, required 9. And it puts walrus(15), badger(17), seal(18), wolverine(22) & frog(28) at the same level.

So the inverse proportionality is relative rather than mathematically absolute. It would require the insertion of 291 additional questions above the unicorn to achieve the math you describe, and in the process, throws away the "compressive" attribute that defines Huffman.

If non-compressive, relative inverse proportionality is sufficient, then my original reading of your question would be more accurate:

Q / \ fish Q / \ cat Q / \ dog Q / \ cow Q / \ horse Q / \ sheep Q / \ wolf Q / \ frog Q / \ wolverine Q / \ seal Q / \ badger Q / \ walrus Q / \ ocelot Q / \ hamster Q / \ gerbil Q / \ platypus Q / \ unicorn Q / \ pegasus axolotl

Which brings me back to the idea that what roboticus' use of Huffman does, is minimise the depth of the tree.

But if that were the goal, then its maximum depth of 9 is 3 more than is required:

__________Q__________ / \ fish ____________________Q______________________ / \ Q _________________________Q_________________ +__________ / \ / + \ cat dog _________Q__________ __ +___________Q_______________ / \ / + \ ____Q____ _____Q______ _____Q___ +___ ______Q______ / \ / \ / + \ / \ Q Q Q Q Q + Q Q Q / \ / \ / \ / \ / \ + / \ / \ / \ cow horse sheep wolf frog wolverine seal badger walrus ocelot ham +ster gerbil platypus unicorn pegasus axolotl

All of which I guess means, that I have no idea what you set out to achieve :(


With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.

In reply to Re^5: Challenge: Optimal Animals/Pangolins Strategy by BrowserUk
in thread Challenge: Optimal Animals/Pangolins Strategy by Limbic~Region

Title:
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!
  • 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
  • Outside of code tags, you may need to use entities for some characters:
            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?
    Username:
    Password:

    What's my password?
    Create A New User
    Chatterbox?
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others studying the Monastery: (5)
    As of 2014-12-21 02:34 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      Is guessing a good strategy for surviving in the IT business?





      Results (101 votes), past polls