GATE / CS ARCHIVE

GATE CSE 1999 / QUESTION 1.16

Multiplications for a power of two

Algorithms · Asymptotic Analysis & Recurrences · Full GATE CSE 1999 paper

GATE 1999, Q1.16 1 mark · MCQ
Report issue

Asymptotic Analysis & Recurrences

Question 1.16, GATE 1999: For n a power of two, how many multiplications are minimally needed to compute a^n? Options log2 n, sqrt(n), n−1,n.
Tap to enlarge
Your answer
Answer & solution

Answer: A (no official key was published)

Write n=2k. Repeated squaring computes a²,a⁴,…,a2^k, using exactly k multiplications. To prove minimality in the ordinary multiplication-only straight-line model, observe that one multiplication can at most double the largest exponent already available. Starting with exponent 1, after t multiplications every computed exponent is at most 2t. Reaching n therefore requires t≥log2 n=k. Construction and lower bound coincide, giving A; n=1 needs zero multiplications.

Original paper, page 2