Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Comment on

( #3333=superdoc: print w/ replies, xml ) Need Help??

Hi Limbic. Good to speak to you again. :-) I don't understand some things you have said.

With the Huffman Coding problem I wanted to take any "holes" in the tree and plug them with some high frequency character tuples.

The reason I don't get this is because normally there are no holes in a properly constructed huffman tree. The tree is "full", that is every node either has two child nodes or is a leaf node with no children, or in other words there are no nodes with only 1 child. This is a necessary aspect of huffman encoding.

Your updates seem to suggest that you aren't going to be doing huffman encoding at all, but some kind of dictionary mapping to fixed size output tokens. Also you said:

when comparing the frequencies 'HE' is the biggest bang for the buck. After substituting it, THEN needs to be knocked out of the list entirely.

It is not clear why this is so. Is this because you aren't allowed overlapping sequences? Or some other reason. Can you explain more?

Anyway, it sounds like this problem is NP hard, so if you really want the perfect solution you will have to brute force it. IMO you dont need to, you can find a "good enough" solution with a couple of iterations I should think. Especially as you say a certain set must appear in the table.

---
$world=~s/war/peace/g


In reply to Re: Dynamically Updating Frequency Analysis by demerphq
in thread Dynamically Updating Frequency Analysis 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 lurking in the Monastery: (5)
    As of 2014-09-16 01:40 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      My favorite cookbook is:










      Results (155 votes), past polls