Given an input matrix A of size 2 x 2 where every element is an integer...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Given an input matrix A of size 2" x 2" where every element is an integer from 0 to 9, the TEN sequence is defined as follows: If n = 0, the TEN sequence consists of only one integer that A contains; • If n > 0, let s be the mode of elements of A (Note that the mode is the number that is repeated most often. If there are multiple modes, s would be the smallest one). You can divide matrix A into four submatrices of size 2-1 x 2-1, the upper left one, the upper right one, the lower left one and the lower right one. The TEN sequence of A is the concatenation of the following 5 sequences: {TEN sequence of the upper left submatrix}, {TEN sequence of the upper right submatrix}, You are given an integer n and a matrix of size 2" x 2". Please calculate the TEN sequence of this matrix. 1 12 52 2 {TEN sequence of the lower left submatrix}, {TEN sequence of the lower right submatrix}. Input The first line contains an integer n. (0 ≤ n ≤ 10) Next 2" lines each contains 2" integers, representing the matrix. Output The only line contains a sequence where each element ought to be an integer from 0 to 9. Adjacent numbers should be separated by a space. Example 1234 2345 1656 0987 Sample Input Sample Output 12252 37 1222 956587 00 Given an input matrix A of size 2" x 2" where every element is an integer from 0 to 9, the TEN sequence is defined as follows: If n = 0, the TEN sequence consists of only one integer that A contains; • If n > 0, let s be the mode of elements of A (Note that the mode is the number that is repeated most often. If there are multiple modes, s would be the smallest one). You can divide matrix A into four submatrices of size 2-1 x 2-1, the upper left one, the upper right one, the lower left one and the lower right one. The TEN sequence of A is the concatenation of the following 5 sequences: {TEN sequence of the upper left submatrix}, {TEN sequence of the upper right submatrix}, You are given an integer n and a matrix of size 2" x 2". Please calculate the TEN sequence of this matrix. 1 12 52 2 {TEN sequence of the lower left submatrix}, {TEN sequence of the lower right submatrix}. Input The first line contains an integer n. (0 ≤ n ≤ 10) Next 2" lines each contains 2" integers, representing the matrix. Output The only line contains a sequence where each element ought to be an integer from 0 to 9. Adjacent numbers should be separated by a space. Example 1234 2345 1656 0987 Sample Input Sample Output 12252 37 1222 956587 00
Expert Answer:
Related Book For
Introduction to Algorithms
ISBN: 978-0262033848
3rd edition
Authors: Thomas H. Cormen, Charles E. Leiserson, Ronald L. Rivest
Posted Date:
Students also viewed these programming questions
-
A compare-exchange operation on two array elements A[i] and A[j], where i < j, has the form COMPARE-EXCHANGE (A, i, j) 1 If A[i] > A[j] 2 exchange A[i] with A[j] After the compare-exchange operation,...
-
The following additional information is available for the Dr. Ivan and Irene Incisor family from Chapters 1-5. Ivan's grandfather died and left a portfolio of municipal bonds. In 2012, they pay Ivan...
-
The following data were taken from the year- end records of Glare Import Company: Required: Fill in all of the missing amounts. Show computations. Year 2 Statement of Eamings Items Gross sales venue...
-
Can an object have zero acceleration and nonzero velocity at the same time? Give examples.
-
A process error may cause the oxide thicknesses on the surface of a silicon wafer to be wavy, with a constant difference between the wave heights. What precautions are necessary in taking a random...
-
Jack DeCoster owned Quality Egg, LLC, an Iowa egg production company. Jacks son, Peter DeCoster, served as the companys chief operating officer. Jack also owned and operated several egg production...
-
On January 1, 2014, Ven Corporation had the following stockholders equity accounts. Common Stock (no par value, 90,000 shares issued and outstanding) ...$1,600,000 Retained Earnings...
-
2. Please using k-means clustering method to cluster these data points in to 2 clusters. Please provide step by step operations. (10 points) Sample: Feature 1 Feature Step1: 1 1234567 2.5 1.5 2 2.0...
-
Jamie Lee Jackson, age 26, is in her last semester of college and is anxiously waiting for graduation day that is just around the corner! She still works part-time as a bakery clerk, has been...
-
X 0 0 0 0 1 1 1 1 What is the Boolean expression for P? y 0 0 1 1 0 0 1 1 Z 0 1 0 1 0 1 0 1 P 1 0 0 1 0 0 1 0 Design a circuit that can produce output P for inputs x, y, and z as expressed in the...
-
In what way is the UCC Statute of Frauds provision relevant when deciding whether parole evidence is admissible? Explain your answer.
-
What is budgeting? Explain.
-
The business is trying to develop a system for good financial governance. What are three examples of conventions this business should follow to maintain compliant financial management throughout all...
-
Under which circumstances might a client choose to set QuickBooks Online to never suggest categorizations from a vendor? Explain.
-
Steven has a $20,000 investment in a five-year XYZ Market-Linked GIC. Return on the GIC is based on the performance of the S&P/TSX Composite Index, with a 65% participation rate. The return on the...
-
In This Project, Especially To Test The Int NextIndex() And Int PreviousIntex() Methods, My Client Class Is Like This Below In this project, especially to test the int nextIndex() and int...
-
Why are stocks usually more risky than bonds?
-
Draw the binary tree rooted at index 6 that is represented by the following attributes: index key left right 1 12 7 3 2 15 8 NIL 3 4 10 NIL 4 10 5 9 2 NIL NIL 18 1 4 7 7 NIL NIL 8 14 2 9. 21 NIL NIL...
-
Prove that COUNTING-SORT is stable.
-
Consider the following 1-variable linear program, which we call P: where r, s, and t are arbitrary real numbers. Let D be the dual of P. State for which values of r, s, and t you can assert that 1....
-
Who was Phar-Mors flamboyant Chief Executive Officer?
-
Which of the following generally is not considered something of value? 1. Cash, money or checks 2. Airline miles or hotel credits associated with frequent activity (e.g., frequent flier miles) 3. An...
-
Can you create a graphic that highlights each incidence where Fairmont was not in compliance with company policy that requires explicit approval of all hours of eighty hours or more?
Study smarter with the SolutionInn App