简体   繁体   English

如何在计划中制作霍夫曼树?

[英]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) 我也有功能。它将两对频率最小的一对组合成一对,如下所示(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. 您将在线阅读经典书籍SICP2.3.4节中的霍夫曼编码树的详细解释。 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. 您只需要将其调整为为您的任务提供的接口/数据结构。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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