What I want to do is have a defined string as the input and use that to run it against the keys, so I can pull out the values. I have some functions beneath for searching, a possibility would be to parse the input and use something along those lines.
Any suggestions or things to make this easier? I would like to try and use a map for this.
I don't think that a map is the best container here.
if the input string has no separators you need to order the morse code according to its length (the longest first) and then match the part of string against them one after another. Otherwise you would have a lot of 'e's
The input string does have seerators; they are 000 between letters and 0000000 between words, the keys take care of the 0's inbetween the letter itself
You can use a binary tree to do the decoding, 0/1 for left/right and at the end of a tree have some letter as an output. Some encoding that is similar to this:
http://en.wikipedia.org/wiki/Huffman_coding
my_morse["1"] = 'e';
That for example, how do can decode if 1 is set to e. How are you going to distinguish e from any other letter if all other letters also start with 1 ? Your "morse" code is ambiguous.
The Binary tree is a good idea,I will look into that as well. The way I'd be able to distinguish the e is because after 1 which is e there would be three 000's meaning the letter had ended and there will never be a case where three consecutive 000's does not mean to look for the next letter.
Within the morse I have (1)000(next letter)(1)(000); this would be to e's and how they would be distinguished.