简体   繁体   中英

How to make huffman tree in scheme?

I am trying to make huffman encoding/decoding in scheme so i have function "frequencies" which makes frequencies list. I made also function which found the the pair form the list with the smallest frequencies and a function which remove the pair with the smallest frequencies from the list. And i dont understand how to make the tree. And when i have the tree how to start encoding? I also have funct.which combine the two pairs with the smallest frequencies into one pair like this (a.3) (b.5) ->((ab).8)

You'll discover a very detailed explanation of Huffman Encoding Trees in section 2.3.4 of the classic book SICP , available online. There you'll find a description of the inner workings of such a tree, along with a complete implementation. You'll only need to adapt it to the interfaces/data structures provided for your assignment.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM