clytaemnestra
New member
- Joined
- Mar 7, 2021
- Messages
- 7
Hi, I've got a task to implement Fan and Huffman algorithm on a given list of probablities and to calculate the optimal length of code. I've done it in Excel (screenshots
attached, if needed I can attach the sheet as well), however I'm not sure if my results are correct.
Two colleagues of mine got the same length in both algorithms, but I got different leghts (1.76 and 1.77). Have I done a mistake somewhere? I'm not really sure about codes in Huffman's algorithm, though, took me quite a lot of time to figure it out.
Thank you in advance.
Fan algorithm:
attached, if needed I can attach the sheet as well), however I'm not sure if my results are correct.
Two colleagues of mine got the same length in both algorithms, but I got different leghts (1.76 and 1.77). Have I done a mistake somewhere? I'm not really sure about codes in Huffman's algorithm, though, took me quite a lot of time to figure it out.
Thank you in advance.
order | probability |
x1 | 0.01 |
x2 | 0.01 |
x3 | 0.01 |
x4 | 0.04 |
x5 | 0.02 |
x6 | 0.01 |
x7 | 0.76 |
x8 | 0.01 |
x9 | 0.01 |
x10 | 0.05 |
x11 | 0.05 |
x12 | 0.02 |
Fan algorithm: