Morse

There are several standards for Morse codes and we will here use a slightly extended version since we also want to code some special character. The Morse code uses, as you probably know, long and short (often pronounced di and da) to encode characters. You might therefore think that is identical to Huffman codes but there is a difference.

You task is to decode the following messages:

  • ".- .-.. .-.. ..-- -.-- --- ..- .-. ..-- -... .- ... . ..-- .- .-. . ..-- -... . .-.. --- -. --. ..-- - --- ..-- ..- ... "
  • ".... - - .--. ... ---... .----- .----- .-- .-- .-- .-.-.- -.-- --- ..- - ..- -... . .-.-.- -.-. --- -- .----- .-- .- - -.-. .... ..--.. ...- .----. -.. .--.-- ..... .---- .-- ....- .-- ----. .--.-- ..... --... --. .--.-- ..... ---.. -.-. .--.-- ..... .---- "

To spare you the trouble of entering the Morse codes in a table, you are given them in a tree. There is also a skeleton code to get you starting.

This is a tutorial that also describes an encoder.

Feedback Nyheter