Question: Please answer the following questions using the instructions given and provide some justification. Exercise 2 (60 points) Analyze transpose algorithm Consider the problem to compute
Please answer the following questions using the instructions given and provide some justification.

Exercise 2 (60 points) Analyze transpose algorithm Consider the problem to compute the transpose A of ann x n matrix A. Consider the pseudocode to compute the transpose of annxnmatrix A 1 sap Aal i and bufEer Al 5 Ai buffer All the questons in this exerdse are relsted to the trasposeMat(A) algonthm. The objecive of this exerdse is to explore whether the time compleity will change if we count different "sctions A) Comparison Action In this onse we count the number of comparisona perfomed by the "for loops" (Lines 1 and 2) Answer the following questions to determine the total number of comparisons performed by the algorithm s. How many comparisons are perfomed by "Yor loop" in Line 1? b. Letus call tthe number of comparisons performed by "for loop" in Line 2 for a given value of i Fill in this table c. Express the total number of comparisons parfomed by the for on inine 2 during the execution of taosasestoxA) d Express the funcfon f(n) that represents the averall total number of oomparisons performed by the fr loops in Lines 1 and 2 during the cxeouton of e. The funcson f(n) grows ike whidh function? B) Assignment Action In this case we count the number of assignments performed by Lines 48. Answer the following questions to detemine the totanumber of assignments performed by the algorithm a. Let us call a, the number of assignments performed by Lines 4-6 for a given value of Fill in this table b. Express the function f(n) thst represents the overall total number of assignments performed by Lines 4-0 during the execution of tansRoSAAatsA) The functon t(n) grows lke C. which function? C) Swap Action In this case, we count the number of swaps AAnnOne swap is perfomed by the three assignments in Lines 4-8 Answer the following questons to determine the total number of swaps performed by the aigorithm of swaps for a given value ofi, Fill in this table b. Express the function f(n) hat represents the overall total number of swaps during the execution of teoaselatoxtA) The funcion f (n) grows l C. ke which function? D) Compare the funcions f(n), f.n), andfn) and discuss their growth E) Space complexity: arwer the following questions. I this algorithm is in-place? Whatis space complesty? How does its space complexity "grow
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
