Description
Basically it is asking to come up with a signal s and two emissions x and y, as
well as to determine if the signal s is an interweaving of the emissions x and
y. For example, suppose x = 101 and y = 0, then s = 100010101 is an
interweaving of x and y since characters 1, 2, 5, 7, 8 and 9 form 101101 which
is a repetition of x and remaining characters 3, 4, 6 form 000 which is a
repetition of y. Here are some conditions:
- The length of s must be longer than x and y.
- The signal s can only contain 0s and/or 1s; if
there exists other numbers, characters or symbols, e.g. 7, 8, #, ^, u, o, and
so on, s is not an interweaving of x and y.
- The signal s may contain up to only 1 character at the front or the back that doesn't match
the pattern of x or y, e.g.
- Suppose x
= 10 and y = 0 then s = 101001 is still interweaving of x and y, as the
characters 1, 2, 3, 4 form 1010 a repetition of x and the characters 5 forms 0
which is y. Even though the character 7 doesn't match the pattern of x or y, we
can purge it and s is still interweaving of x and y.
- Suppose x = 100 and y = 1 then 011100 is still
interweaving of x and y, as the characters 4, 5, 6 form 100 which is x and the
characters 2 and 3 form 11 which is repetition of y. Even though the character
1 doesn't match the pattern of x or y, we can purge it and s is still
interweaving of x and y.
- The input
file shall contain multiple sets of s, x and y and the output shall provide the
result for each set of input whether s is interweaving of x and y or not; if
yes, please list the characters that form x and y and purged character (if
any), if no, please list the reason why, e.g. there is a "#" symbol
in character 6 of s so s is not interweaving of x and y.
- The input
file shall contain 5 to 15 examples but the program should be able to process
as many examples as it can.
- Please incorporate some mechanism to count the number of computational steps in the program.
It is much appreciate if you could provide the solution by
next Monday. Please refer to the attachment for detailed
requirements.
Thanks,
Preston