Leran how to compress a string of text by using Huffman encoding, including constructing a tree from scratch and using it to encode and decode a compressed binary representation of a message.
I have no idea why but I always prefer just good old pencil and paper (in this case a sharpie) demonstration. I don't need a bunch of effects for something like this. And it feels like someone's right there with you showing you something cool.
very crispy and direct walkthrough, thank you Mr. D. A note of caution for future productions though: your |s and |s look identical. (See what I did there?)
let's assume instead of sp being 3, it was 5 (ignoring the rest of the characters with higher frequencies for now), then would we still have done n+sp which would be 2+5=7, or would we add 4+n which would add up to 6?
Its from ASCII, which uses 7 bits to encode a letter, since there are 21 total letters, and each letter takes 7 bits, the totals bits required is 21 multiplied by 7. Compare this to only 67 bits when we compress rather than using ascii.
this is not the best method because it is only for elements that add together to an even number, if there are an odd number of elements there are actually better huffman trees that compress more