Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

A Golf question maybe? Huffman with a twist

by demerphq (Chancellor)
on Sep 03, 2001 at 05:50 UTC ( [id://109803]=perlmeditation: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    The Huffman algorithm pairs the sub-trees by weight. As long as there 
    +are more than one sub-tree, pairs the lightest two into one sub-tree.
    + I chose to have the lightest branches on the left (bit 0). 
    
    ...
           /\  /\            sub-tree noted at its root) drawn on the left
    +.
          D  EF  G
    
  2. or download this
                49         For alphabet and:        27 A
                /\         and weights as so:       15 B
    ...
    
    A=1   C=001   E=00001 G=00011
    B=01  D=00000 F=00010
    
  3. or download this
    a 27 1
    b 15 01
    ...
    e 1  00101
    f 1  00110
    g 1  00111
    
  4. or download this
    a 27 1
    b 15 01
    ...
    e 1  00001
    f 1  00010
    g 1  00011
    

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlmeditation [id://109803]
Approved by root
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (3)
As of 2024-04-24 23:22 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found