Practice free →
HomeGATE CSEcomputerscienceAlgorithms › The recurrence relation for merge sort's running…

The recurrence relation for merge sort's running time is

AT(n) = T(n-1) + Θ(n)
BT(n) = 2T(n-1) + Θ(1)
CT(n) = T(n/2) + Θ(1)
DT(n) = 2T(n/2) + Θ(n)
Answer & Solution
Correct answer: D. T(n) = 2T(n/2) + Θ(n)
Merge sort makes two recursive calls on halves of the input (2T(n/2)) and then does a linear merge (Θ(n)). The master theorem solves this to Θ(n log n). The other options describe different algorithms: T(n-1)+Θ(n) is insertion sort's worst case, T(n/2)+Θ(1) is binary search, 2T(n-1)+Θ(1) is exponential.
Solve this in the app — GATE CSE practice & 24k+ MCQs →
Related questions