Please show the steps manually The following message was enc
Please show the steps manually.
The following message was encoded with the matrix B shown below. Use the matrix method we learned in class to decode the message: Message: 2, -10, 18, -1, -31, 13, -30, -1, -26, -22, 3, 3, -15, 5, -8, -13, 29, 22, -12, -25, 17, 26, 4, -28, -3, 13, 31, 21, 15, 38, 29, 33, 37, 10, 33, 21, 25, 42, 39, 1, 5, 37, 44, 19, 32, 39, 35, 23, 37, 36, 17, 4, 31, 23, 20, 38, 48, 38, 42, 24, 33, 41, 33, 47, 64, 5, 5, 53, 62, 34, 34, 40, 37, 35, 62, 36, 33, 25, 100, 56, 48, 127, 127, 79, 124, 51, 100, 104, 81, 119, 143, 7, 18, 133, 137, 64, 104, 129, 87, 84, 138, 128, 79, 37 B = [-2 1 1 4 1 0 1 1 1 1 1 3 0 1 1 2] Write out the encoded message in ALL CAPS. Show your work, including any matrices you generated in solving the problem.Solution
int main(void)
{
...................
// elems is an integer array of size (r * c). So maximum of 400 will suffice
// After calling this, read the first (r * c) elements from the elems array
// to get the bits in correct order
readSpiralMatrix(matrix, 0, 0, r - 1, c - 1, elems, 0);
...................
}
void readSpiralMatrix(int matrix[20][20], int top, int left, int bottom, int right, int elems[], int cur)
{
int k;
if ((top > bottom) || (left > right)) {
return;
}
for (k = left; k <= right; k++) {
elems[cur++] = matrix[top][k];
}
for (k = top + 1; k <= bottom; k++) {
elems[cur++] = matrix[k][right];
}
for (k = right - 1; k >= left; k--) {
elems[cur++] = matrix[bottom][k];
}
for (k = bottom - 1; k > top; k--) {
elems[cur++] = matrix[k][left];
}
readSpiralMatrix(matrix, top + 1, left + 1, bottom - 1, right - 1, elems, cur);
}
