in reply to Re: Challenge: Optimal Animals/Pangolins Strategy
in thread Challenge: Optimal Animals/Pangolins Strategy
Then I must have made a mistake in my explanation because the solution should be closer to Huffman coding as roboticus astutely concluded above. Since I can't explain why what I am trying to accomplish is slightly different, I guess I am stuck.
Cheers - L~R
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^3: Challenge: Optimal Animals/Pangolins Strategy
by BrowserUk (Patriarch) on May 02, 2013 at 23:18 UTC | |
Well, you mentioned proportional which I interpreted to mean that higher frequencies should take longer to reach than lower frequencies, which barring the possibility of equal frequencies, a lop-sided tree achieves. (Albeit you said inversely proportional which would mean reversing the order of the sort from what I posted.) The only other sense I can get from the information provided -- brought on by the mention of Huffman -- is that you are perhaps looking to minimise the depth of the tree. This does that by building a heap and then converting it to a tree rather clumbsily. Though that could be fixed if the idea is right:
Output:
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.
| [reply] [d/l] [select] |
by Limbic~Region (Chancellor) on May 03, 2013 at 13:45 UTC | |
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. I apologize for not seeing it before hand, but I am pretty sure the optimal strategy for my problem is in fact Huffman Coding. To get a better idea of the fuzzy problem I am dealing with in my head, see Re^4: Challenge: Optimal Animals/Pangolins Strategy Cheers - L~R | [reply] |
by BrowserUk (Patriarch) on May 04, 2013 at 06:14 UTC | |
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:
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:
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:
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.
| [reply] [d/l] [select] |
by Limbic~Region (Chancellor) on May 06, 2013 at 15:28 UTC | |
by BrowserUk (Patriarch) on May 06, 2013 at 16:00 UTC | |
Re^3: Challenge: Optimal Animals/Pangolins Strategy
by jakeease (Friar) on May 05, 2013 at 04:43 UTC | |
Aren't Huffman trees generally expected to be lop-sided? | [reply] |
by Limbic~Region (Chancellor) on May 06, 2013 at 15:45 UTC | |
[reply] |