早教吧作业答案频道 -->数学-->
给定权值(7,18,3,32,5,26,12,8),构造相应的哈夫曼树如题,麻烦写出过程,谢谢!原题我看过,不过不够细,可否细一些
题目详情
给定权值(7,18,3,32,5,26,12,8),构造相应的哈夫曼树
如题,麻烦写出过程,谢谢!
原题我看过,不过不够细,可否细一些
如题,麻烦写出过程,谢谢!
原题我看过,不过不够细,可否细一些
▼优质解答
答案和解析
这还不够细?
3+5=8,此时序列为8 7 8 12 18 26 32
7+8=15,此时序列为15 8 12 18 26 32
8+12=20,此时序列为15 20 18 26 32
……每一步都挑最小的两个相加.
图见下面.
多看书,baidu上不好画图,打这些东西很累.
------------------
原答题者:plause
按权值大小排列后 3 5 7 8 12 18 26 32
只要按照将最小的两个合并, 合并后的值再入列中(最小的两个出列), 至到列中只有一个值.
按上面要求构造哈夫曼树如下:
/////树列完后, 可取左树编码 为0, 右为 1, (左为 1, 右为 0 亦可)
[3]`````[5]`````````[7]``````[8]
``\`````/`````````````\``````/
`0`\```/`1```````````0`\````/`1
````\`/`````````````````\``/
````(8)`````[12]````````(15)`````[18]
``````\``````/`````````````\``````/
`````0`\````/`1```````````0`\````/`1
````````\``/`````````````````\``/
````````(20)``````[26]```````(33)``````[32]
```````````\``````/`````````````\``````/
``````````0`\````/`1```````````0`\````/`1
`````````````\``/`````````````````\``/
`````````````(46)`````````````````(65)
````````````````\`````````````````/
```````````````0`\```````````````/`1
``````````````````\`````````````/
```````````````````````(111)
则按上面的树可得到各权值所对应的编码:
//// 其编码是从树顶到该权值点所经过的 1 或 0 的序列
[`7]:``1`0`0`0
[18]:``1`0`1
[`3]:``0`0`0`0
[32]:``1`1
[`5]:``0`0`0`1
[26]:``0`1
[12]:``0`0`1
[`8]:``1`0`0`1
3+5=8,此时序列为8 7 8 12 18 26 32
7+8=15,此时序列为15 8 12 18 26 32
8+12=20,此时序列为15 20 18 26 32
……每一步都挑最小的两个相加.
图见下面.
多看书,baidu上不好画图,打这些东西很累.
------------------
原答题者:plause
按权值大小排列后 3 5 7 8 12 18 26 32
只要按照将最小的两个合并, 合并后的值再入列中(最小的两个出列), 至到列中只有一个值.
按上面要求构造哈夫曼树如下:
/////树列完后, 可取左树编码 为0, 右为 1, (左为 1, 右为 0 亦可)
[3]`````[5]`````````[7]``````[8]
``\`````/`````````````\``````/
`0`\```/`1```````````0`\````/`1
````\`/`````````````````\``/
````(8)`````[12]````````(15)`````[18]
``````\``````/`````````````\``````/
`````0`\````/`1```````````0`\````/`1
````````\``/`````````````````\``/
````````(20)``````[26]```````(33)``````[32]
```````````\``````/`````````````\``````/
``````````0`\````/`1```````````0`\````/`1
`````````````\``/`````````````````\``/
`````````````(46)`````````````````(65)
````````````````\`````````````````/
```````````````0`\```````````````/`1
``````````````````\`````````````/
```````````````````````(111)
则按上面的树可得到各权值所对应的编码:
//// 其编码是从树顶到该权值点所经过的 1 或 0 的序列
[`7]:``1`0`0`0
[18]:``1`0`1
[`3]:``0`0`0`0
[32]:``1`1
[`5]:``0`0`0`1
[26]:``0`1
[12]:``0`0`1
[`8]:``1`0`0`1
看了 给定权值(7,18,3,32...的网友还看了以下:
给定权值(7,18,3,32,5,26,12,8),构造相应的哈夫曼树如题,麻烦写出过程,谢谢!原 2020-05-16 …
给定权值 {19,01,23,14,55,20,84,27 },构造相应的哈夫曼树,计算WPL. 2020-05-16 …
统计机构应当依法履行其职权,不能放弃职权,但在一定情况下可以转让其职权。( ) 2020-05-21 …
采购机构授权委托采购代理机构办理采购事宜时,应当( ),并与其签订委托代理协议,明确双方的权利 2020-06-07 …
构造Huffman树及计算假设在通信中要传输一组字符“ABC,AAABCC,ABC,DDC,AAA 2020-06-10 …
对于设有构造柱的抗震多层砖房,下列哪些做法正确()A.构造柱拆模后再切砖墙B.墙与构造柱沿高度方向 2020-06-18 …
给定权值7,6,3,32,5,26,12,9,构造相应的哈夫曼树,并计算其带权路径长度。为使结果答 2020-06-23 …
2009年6月13日,秦始皇兵马俑一号坑开始进行第三次考古发掘。考古队认为,秦陵很可能整体就是一个政 2020-11-03 …
清朝有这样一个机构,它机构简单,人员精干,是辅助皇帝处理政务的最重要的中枢机构。它的设立是专制皇权高 2020-11-05 …
设某通信系统使用八A,B,C,D,E,F,G,H个字符,他们出现的概率w={5,29,7,8,14, 2020-11-07 …