Menu

First Picture Transposematrix Algorithm Ive Done Part 1 2 Cannot Figure Questions Second P Q43901350

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

Consider the problem to compute the transpose AT of an n x n matrix A. Consider the pseudocode to compute the transpose of anC) (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 a

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”? Show transcribed image text 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”?

Expert Answer


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

OR