如何开始建立霍夫曼树? [英] how to start building huffman tree?

查看:73
本文介绍了如何开始建立霍夫曼树?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

hi
我想编写一个用霍夫曼树压缩文件的程序!
我是Java的初学者,不知道如何开始:|

您有任何想法或类似的简单程序吗?

我在其他站点上创建了许多代码,但是它们都太难了

而且我不明白那些代码:(

请帮助

hi
i want to code a program that, with huffman tree compress a file!
i am beginner in java , and have no idea how to start :|

do you have any idea or have any simple program like that ??

i founded many codes in other sites but all of them are too hard

and i cant understand those codes :(

please help

推荐答案

看看霍夫曼.java [^ ]

这是我从
Have a look at Huffman.java[^]

It was the first search result I got from Google [^]

Best regards
Espen Harlinn


开始编写一个简单的应用程序来构建树.该过程非常简单,应按符号出现的顺序对初始树(平面)进行排序,然后:
Start writing a simple application for building the tree. The process is pretty strightforward, the initial tree (flat) should be ordered by symbol occurrences, then:
  1. 从树中删除两个底部节点,并创建一个新节点,其出现次数"等于已删除事件的出现之和(并且精确地等于已删除事件"的出现次数)子级.
  2. 将新创建的节点插入到原始树中(在正确的位置以保持树的顺序).



重复上述两个步骤,直到拥有一棵正确的单根树.
如果您在执行此操作时遇到麻烦,可以在此处发表您的疑问.



Repeat the two above steps until you have a properly single rooted tree.
If you have troubles in doing this, the you may post your doubts here.


这篇关于如何开始建立霍夫曼树?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆