Getting the Messages
Note: Use Java to implement this
The
Morse code is
A .- |
B -… |
C -.-. |
D -.. |
E . |
F ..-. |
G --. |
H …. |
I .. |
J .--- |
K -.- |
L .-.. |
M -- |
N -. |
O --- |
P .--. |
Q --.- |
R .-. |
S … |
T - |
U ..- |
V …- |
W .-- |
X -..- |
Y -.-- |
Z --.. |
|
|
You
have to write a program for an automatic decoder on the assumption that the raw
input data has been preprocessed. In this preprocessed form, dots and dashes
are represented by two-bit sequences, as indication of end of letter and end of
word. These are shown in the table below
Symbol or
delimiter |
Two-bit
sequence |
. |
01 |
- |
10 |
End
of letter |
00 |
End
of word |
11 |
The
end of a sentence is denoted by two consecutive end of word sequences, i.e.,
1111.
The
data for your program will be therefore be entered as a sequence of bit pairs.
For example, the message HELLO STOP I LOVE YOU STOP will be represented by the
bit sequence
0101010100010001100101000110010100101010001111010100110110010100101010000101011000010011100110100010101000010110001111
In
order to reduce searching time, the alphabetic characters should be stored
using B+Tree or B*Tree. Make sure your program is well tested.
Get Free Quote!
259 Experts Online