Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

(ichi) Re: Converting Stream of bits back into Stream of Characters it Encodes

by ichimunki (Priest)
on Jun 10, 2002 at 19:49 UTC ( #173276=note: print w/ replies, xml ) Need Help??


in reply to Converting Stream of bits back into Stream of Characters it Encodes

This code looks suspiciously like the examples for Huffman Encoding in "Mastering Algorithms with Perl". I'm not sure what you think it should do, but the ',' in there is not valid syntax and should be replaced with a '?'. You've also got a $cur_code where you want a $cur_node. For your typo convenience, all of the examples in the book are available in .tar.gz or .zip format from O'Reilly's web site.

We really need to see what you constructed for the get_bit() and put_stream() routines and how you constructed your hash tree.

If you still don't understand how this works after you get the typos fixed, I'm sure we can discuss how this walks down a tree looking for nodes, checking whether a node contains a value or a link/reference to another node, and outputting any values found or following the link/reference to the next node depending on what it finds in the current node. :)


Comment on (ichi) Re: Converting Stream of bits back into Stream of Characters it Encodes

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://173276]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (8)
As of 2014-12-29 07:29 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

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





    Results (185 votes), past polls