Question: The first picture is the transposeMatrix(A) algorithm. Ive done Part 1 and 2 but cannot figure out the questions in the second picture. Consider the

The first picture is the transposeMatrix(A) algorithm. Ive done Part 1 and 2 but cannot figure out the questions in the second picture.

The first picture is the transposeMatrix(A) algorithm. Ive done Part 1 and2 but cannot figure out the questions in the second picture. Consider

Consider the problem to compute the transpose AT of an n x n matrix A. Consider the pseudocode to compute the transpose of an n x n matrix A transposeMatrix(A) for = | ton for j = / to j-| Il swap A[i] [i] and buffer = A[i] Ali Gil. = A[i] [i. Al [i] = buffer C) (16 points) Swap Action In this case, we count the number of swaps A[i] [i] >A[] [i]. One swap is performed by the three assignments in Lines 4- 6. Answer the following questions to determine the total number of swaps performed by the algorithm transposeMatrix(A). a. Let us calls the number of swaps for a given value of j. Fill in this table: n-1 b. Express the function f(n) that represents the overall total number of swaps during the execution of transposeMatrix(A). c. The function f(n) grows like which function? D) (6 points) Compare the functions f.(n), fon), and f(n) and discuss their "growth. IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII E) (6 points) Space complexity: answer the following questions. Is this algorithm is in-place? What is its space complexity? How does its space complexity "grow"? Consider the problem to compute the transpose AT of an n x n matrix A. Consider the pseudocode to compute the transpose of an n x n matrix A transposeMatrix(A) for = | ton for j = / to j-| Il swap A[i] [i] and buffer = A[i] Ali Gil. = A[i] [i. Al [i] = buffer C) (16 points) Swap Action In this case, we count the number of swaps A[i] [i] >A[] [i]. One swap is performed by the three assignments in Lines 4- 6. Answer the following questions to determine the total number of swaps performed by the algorithm transposeMatrix(A). a. Let us calls the number of swaps for a given value of j. Fill in this table: n-1 b. Express the function f(n) that represents the overall total number of swaps during the execution of transposeMatrix(A). c. The function f(n) grows like which function? D) (6 points) Compare the functions f.(n), fon), and f(n) and discuss their "growth. IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII E) (6 points) Space complexity: answer the following questions. Is this algorithm is in-place? What is its space complexity? How does its space complexity "grow

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!