GateAI
Asymptotic Analysis

GATE CSE 2015 Set 1 · Q2

MCQ1 markEasy

Time

Which one of the following is the recurrence equation for the worst case time complexity of the Quicksort algorithm for sorting nn (≥2\ge 2) numbers? In the recurrence equations given in the options below, cc is a constant.

Select one answerSingle correct

Pick an option to check

Solution

Step-by-step verified solution

Official answer: B) T(n) = T(n - 1) + T(1) + cn

Asymptotic Analysis

In Quicksort, the worst case occurs when the partitioning routine always produces the most unbalanced split possible (for instance, when the pivot is always the minimum or maximum element).

In this scenario:

  1. One subproblem has size n−1n - 1.

  2. The other subproblem has size 11 (or 00).

  3. Partitioning the array takes linear time, cncn.

Hence, the recurrence equation representing the worst-case time complexity is:

T(n)=T(n−1)+T(1)+cnT(n) = T(n-1) + T(1) + cn

This solves to $O(n^2)$. Therefore,Option (B) is the correct choice.

Try the question first, then check your work.

Think the official key or this write-up is wrong?

Report error or challenge

Examiner trap

The misconception this question tests

This Asymptotic Analysis previous year question is Q2 of the GATE CSE 2015 Set 1 paper. Find more GATE CSE PYQs on Asymptotic Analysis in Algorithms, or browse all GATE CSE PYQs.

Free diagnostic

Where do you stand for GATE?

Take the 20-minute diagnostic: the 3 topics that cost you the most marks, and a rank range. Or sit 5 related Asymptotic Analysis PYQs now with no account.

One GATE CSE PYQ every morning

An official question by email at 7 AM IST, with a link to its verified solution. Unsubscribe in one click.

Asymptotic Analysis in GATE CSE

Asymptotic Analysis has 31 GATE CSE PYQs across 19 papers from 2011 to 2026. 15 of them are 1-mark MCQs like this one, and GATE CSE 2015 Set 1 has 2.

How GATE tests Asymptotic Analysis

More from GATE CSE 2015 Set 1

Share this solution

A plain-text card for WhatsApp or Telegram study groups.

GateAI solution cardGATE CSE 2015 Set 1 · Q2 · MCQ

Which one of the following is the recurrence equation for the worst case time complexity of the Quicksort algorithm for sorting n (≥ 2) numbers? In the recurrence equations given in the options below, c is a constant.

Topic-wise GATE CS PYQs with verified steps

Independent practice explanation verified by the GateAI team. GATE is conducted by the IITs; question text follows the official paper.