Question: Please analyzetranspose algorithm following the instructions given. Pts your agorithm in-place? Exercise 2 (60 points) Analyze transpose algorithm Consider the problem to compute the transpose

Please analyzetranspose algorithm following the instructions given.  Please analyzetranspose algorithm following the instructions given. Pts your agorithm in-place?
Exercise 2 (60 points) Analyze transpose algorithm Consider the problem to compute
the transpose AT of an n x n matrix A Consider the

Pts your agorithm in-place? Exercise 2 (60 points) Analyze transpose algorithm 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) 1: for i=1 to n 2: for -1 toi-1 // swap A[i] [j] and 5: 6: All the questions in this exercise are related to the transposeMatrix(A) algorithm. Th this exercise is to explore whether the time complexity will change if we count A[i] [jAj) [i] A(j] [i] buffer e objective of different "actions" A) Comparison Action In this case, we count the number of comparisons performed by the for loops (Lines 1 and 2) the Answer the following questions to determine the total number of comparisons performed by algorithm transposeMatrix(A) a. How many comparisons are performed by "for loop" in Line 1? b. Let us call t the number of comparisons performed by "for loop" in Line 2 for a given value of i. Fill in this table 2 -1 c. Express the total number of comparisons performed by the "for loop in Line 2 d. Express the function fe(n) that represents the overall total number of comparisons e. The function fo(n) grows like which function? during the execution of transposeMatrix(A) performed by the for loops" in Lines 1 and 2 during the execution of transposeMatrix(A) B) Assignment Action In this case, we count the number of assignments performed by Lines 4-6. Answer the following questions to determine the total number of assignments performed by the algorithm transposeMatrix(A) Let us call a the number of assignments performed by Lines 4-6 for a given value of i. Fill in this table a. n-1 b. Express the function fa(n) that represents the overall total number of assignments performed by Lines 4-6 during the execution of transposeMatrix(A) The function fa(n) grows like which function? c. C) Swap Action In this case, we count the number of swaps AlDAli) 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 call si the number of swaps for a given value of i. Fill in this table n-1 b. Express the function fs(n) that represents the overall total number of swaps during the execution of transposeMatrix(A). C. The function fs(n) grows like which function? D) Compare the functions fe(n), fa(n), and fa(n) and discuss their "growth" E) 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!