GATE Computer ScienceModerateGATE CS (PYQ pattern)
Karatsuba multiplies two n-digit numbers (n = 2^k) with 3 half-size products, recursing down to 1-digit numbers; the classical method uses n² single-digit products. What is the smallest such n for which Karatsuba uses fewer than one tenth as many single-digit multiplications as the classical method?
- A. 256
- B. 1024
- C. 512
- D. 128
Correct answer: C. 512
Karatsuba uses 3^k products versus 4^k, a ratio of (3/4)^k. (3/4)^8 = 0.1001… is just above 0.1, while (3/4)^9 = 0.0751 is below, so k = 9 and n = 512. Rounding (3/4)^8 to 0.1 gives the trap answer 256.
More Algorithms questions
- 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…
- The edit distance between PNEUMONIA and AMMONIA is computed with insertion, deletion and substitution each costing 1. What is the minimum…