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?

  1. A. 12
  2. B. 16
  3. C. 14
  4. 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

Exams that ask this topic