GATE Computer ScienceVery hardGATE CS (PYQ pattern)
Multiplying two n × n matrices classically costs n³ multiplications and n²(n − 1) additions. One level of Strassen (7 products of n/2 × n/2 matrices done classically, plus 18 additions/subtractions of n/2 × n/2 matrices) is used instead. Counting all scalar additions and multiplications, what is the smallest even n for which one Strassen level is strictly cheaper than the classical method?
- A. 12
- B. 16
- C. 14
- D. 32
Correct answer: B. 16
Classical: 2n³ − n². One level: 7(2(n/2)³ − (n/2)²) + 18(n/2)² = 7n³/4 + 11n²/4. It is cheaper when 7n³/4 + 11n²/4 < 2n³ − n², i.e. n³/4 > 15n²/4, i.e. n > 15. Check: n = 14 gives 5341 vs 5292 (worse), n = 16 gives 7872 vs 7936 (better).
More Algorithms questions
- Karatsuba multiplies two n-digit numbers (n = 2^k) with 3 half-size products, recursing down to 1-digit numbers; the classical method uses…
- Let T(1) = 1 and T(n) = (1 + 1/n)·T(n − 1) + 1 for n ≥ 2. Which is the tight bound on T(n)?
- The running time satisfies T(n) = T(n/2) + T(n/3) + T(n/6) + n. Which bound is tight?
- Solve T(n) = √n·T(√n) + n·log₂ n for n = 2^(2^k), with T(2) = 2. Which is the tight bound?
- The maximum and the minimum of n numbers are found by divide and conquer: a list of 1 element needs 0 comparisons, 2 elements need 1; a…
- The strings X = XYXZYXZ and Y = YZXYXZY are given. Their longest common subsequences all have length 5. How many distinct strings of…