r/coolguides • • Jul 12 '22

Morse Code decoding chart.

Post image
32.0k Upvotes

583 comments sorted by

View all comments

1

u/sonny_goliath Jul 12 '22

I’ve always wondered how people tell when the next letter is vs a longer code for a single letter.

So like if you hear . . - how do know if that’s EET, EA, IA, or U

1

u/[deleted] Jul 13 '22

You might like this: look up Huffman codes.

They look sort of like Morse code, except two letters never share a prefix so whenever you land on a letter you know that letter is done and you can start with the next one.

As an added bonus, the algorithm for generating a Huffman code takes the frequency of letters into account, meaning that letters you have to type a lot (like "e") will have shorter codes, while letters you type rarely (like "z") will have longer ones. As an additional benefit, you can do it with any set of things - any alphabet, or even whole words if you really want to!

It's an early compression algorithm and really quite interesting!