GATE / CS ARCHIVE

GATE CSE 1999 / QUESTION 2.21

Matching recurrence growth

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

GATE 1999, Q2.21 2 marks · MSQ
Report issue

Asymptotic Analysis & Recurrences

Question 2.21, GATE 1999: M:T(n)=T(n−1)+n; N:T(n)=T(n/2)+n; O:T(n)=T(n/2)+n log n; P:T(n)=T(n−1)+log n. Match to U O(n),V O(n log n),W O(n²),X O(log² n).
Tap to enlarge
Select all that apply
Answer & solution

Answer: B: M-W,N-U,O-V,P-V (no official key was published)

For M, summing 1+2+…+n gives Θ(n²). For N, the work is n+n/2+n/4+…=Θ(n). For O, the first term already gives n log n and the geometric weighted tail is O(n log n), hence Θ(n log n). For P, summing log k for k=2…n gives log(n!)=Θ(n log n): the upper bound is n log n and the last n/2 terms each exceed log(n/2). Thus M-W,N-U,O-V,P-V, option B. The listed big-O labels are interpreted as tight intended growth classes; loose upper bounds would not define a unique matching.

Original paper, page 5