Ray
BAN USER- 0of 0 votes
AnswersImplement the Huffman compression algorithm as shown in the example below:
1) Given a string AAAAAABBCCDDEEFFFFF, group them according to the number of occurrences: A => 6, B => 2, C => 2, D => 2, E => 1, F => 5
2) Concatenate them according to their number of occurrences (adding the number of occurrences while doing it)
3) Put the concatenate strings in a tree-like structure:
- Ray in United StatesADEBCF(19) / \ / \ / \ / \ / \ / \ / \ ADE(10) BCF(9) / \ / \ / \ / \ / \ / \ A(6) DE(4) BC(4) F(5) / \ / \ / \ / \ / \ / \ D(2) E(2) B(2) C(2)
| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer Amazon