All mock tests are FREE till 31 December — register to save your progress
Unit 7 · Data Structures and Algorithms Paper 2 CS · December 2019

The following multithreaded algorithm computes transpose of a matrix in parallel : p Trans (X, Y, N) if N = 1 ← then Y[1,1] X[1,1] else partition X into four (N/2) x (N/2) X X X X submatrices 11, 12, 21, 22 partition Y into four (N/2) x (N/2) submatrices Y Y Y Y 11, 12, 21, 22 X Y spawn p Trans ( 11. 11.N/2) X Y spawn p Trans ( 12. 12.N/2) X Y spawn p Trans ( 21. 21.N/2) X Y spawn p Trans ( 22. 22.N/2) What is the asymptotic parallelism of the algorithm?

Pick an option to check yourself, or open the answer below.

Show answer & explanation

Correct answer: A. T₁/T∞ = Θ(N²/lg N)

Explanation

Work T₁ = Θ(N²) (every element is copied); span T∞ = Θ(lg N) (recursion depth). Parallelism = Θ(N²/lg N).

More Data Structures and Algorithms questions