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 :(
In reply to Re^5: Challenge: Optimal Animals/Pangolins Strategy
by BrowserUk
in thread Challenge: Optimal Animals/Pangolins Strategy
by Limbic~Region
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |