早教吧作业答案频道 -->数学-->
给定权值(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...的网友还看了以下:
whyshouldwedoexercise(锻炼)?的英语作文?各位好!本人是高一在校生,因英语确 2020-04-08 …
解一道关于数列的数学题,谢谢已知S10=30,S20=70,则S30=?我明天要一摸了,突然忘了怎 2020-04-26 …
慈母手中线.的题目是什么?急急急急急急急急急!快快快快快快快快快!麻烦麻烦麻烦麻烦! 2020-05-13 …
“初一”的几何题做的时候应该先从哪里入手?(麻烦举题目说明)还有就是出几道“初一”的几何题.谢谢. 2020-05-20 …
跪求三阶魔方顶层两个角块互换公式(麻烦用字母谢谢)右上和右下我只要公式,不要什么OLLPLL的,给 2020-06-03 …
麻烦各位好心的大虾帮我翻译一下,很简单的...我下个星期一就要做DUTY了.麻烦了哈,谢谢在《泰坦 2020-06-20 …
求数学高手帮忙解下这道题!谢谢了!已知直线L:y=2x和点P(6,1),在L上求一点Q,使Q在第一 2020-07-04 …
小学数学应用题100个和尚吃100个馒头大和尚一人吃3个,小和尚3个吃一个.求大小和尚各多少个?麻 2020-07-06 …
问一道英语选择题,谢谢~~~~~~Evenatthatearlystage,theschoolfe 2020-07-25 …
关于“迦陵频伽”的读音问题,谢我只知道“拁”这个字是个多音字,但并不知道这个字放到这个词里的正确读 2020-07-28 …