GateAI
Searching, Sorting and Hashing

GATE CSE 2013 · Q6

MCQ1 markEasy

Time

Which one of the following is the tightest upper bound that represents the number of swaps required to sort nn numbers using selection sort?

Select one answerSingle correct

Pick an option to check

Solution

Step-by-step verified solution

Official answer: B) O(n)

Searching, Sorting and Hashing

In selection sort, the algorithm divides the input list into two parts: a sorted sublist and an unsorted sublist. In each of the n−1n-1 passes, it finds the minimum element from the unsorted sublist and places it at the beginning of the unsorted sublist using at most one swap.

Therefore, the maximum number of swaps performed by selection sort is n−1n - 1, which is bounded by O(n)O(n).

Thus, the tightest upper bound representing the number of swaps is O(n)O(n) (Option B).

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 Searching, Sorting and Hashing previous year question is Q6 of the GATE CSE 2013 paper. Find more GATE CSE PYQs on Searching, Sorting and Hashing 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 Searching, Sorting and Hashing 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.

Searching, Sorting and Hashing in GATE CSE

Searching, Sorting and Hashing has 27 GATE CSE PYQs across 20 papers from 2012 to 2026. 9 of them are 1-mark MCQs like this one, and GATE CSE 2013 has 2.

How GATE tests Searching, Sorting and Hashing

More from GATE CSE 2013

Share this solution

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

GateAI solution cardGATE CSE 2013 · Q6 · MCQ

Which one of the following is the tightest upper bound that represents the number of swaps required to sort n numbers using selection sort?

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.