Elementary Sorting Algorithms Previous Year Questions (PYQs) for GATE DA: 3+ Solved Questions with Step-by-Step Solutions

    Solve 3+ Elementary Sorting Algorithms previous year questions for GATE DA with answers and detailed solutions. Free sample questions below.

    Chapter Roadmap: Elementary Sorting Algorithms

    Chapter Roadmap

    Elementary Sorting Algorithms

    Topic 1: Bubble, Insertion and Selection Sort Pass Analysis
    Master the invariants, intermediate states, and exact operation counts for the three elementary sorts. (Current Topic)
    Topic 2: Insertion Sort Swaps and Nearly Sorted Arrays
    Deep dive into shifts, swaps, and the mathematics of inversions in partially sorted data.

    The Core Idea of Pass Analysis

    The Core Idea of Pass Analysis

    The Concept of a "Pass"

    A pass is one complete iteration of the algorithm's primary loop. In exam questions, you are rarely asked to sort the whole array. You are asked to determine the state of the array after exactly passes.

    The Golden Rule

    Do not trace the whole algorithm. Identify the invariant: what is mathematically guaranteed to be in its final sorted position after pass ?

    • Bubble Sort: Locks elements at the end.
    • Selection Sort: Locks elements at the beginning.
    • Insertion Sort: Sorts a prefix of the array.

    Elementary Sorting Algorithms: Solved Questions with Step-by-Step Explanations (3 Problems)

    Question 1 · Programming, Data Structures and Algorithms MSQ
    Consider the problem of sorting the given array in ascending order:

    P = [1, 2, 3, 5, 4]

    Consider two sorting algorithms Bubble Sort (BS) and Insertion Sort (IS).

    Let N1 be the total number of comparisons done by BS on the elements of P and N2 be the total number of comparisons done by IS on the elements of P.

    Which of the following options is/are correct?
    1. A.

      N1 = 10, N2 = 4

    2. B.

      N1 > N2

    3. C.

      IS on P will perform only one swap

    4. D.

      Both BS and IS on P will make at least one unnecessary comparison (i.e., comparing elements that are already in correct order)

    Question 2 · Programming, Data Structures and Algorithms MCQ
    Consider the following sorting algorithms:
    Bubble sort
    Insertion sort
    Selection sort
    Which ONE among the following choices of sorting algorithms sorts the numbers
    in the array [4, 3, 2, 1, 5] in increasing order after exactly two passes over the array?
    1. A.

      only

    2. B.

      only

    3. C.

      and only

    4. D.

      and only

    Question 3 · Programming, Data Structures and Algorithms MSQ

    Suppose that insertion sort is applied to the array and it takes exactly two swaps to sort the array. Select all possible values of .

    1. A.

    2. B.

    3. C.

    4. D.

    More previous year questions (pyqs) in this unit

    chapter
    Elementary Sorting Algorithms Previous Year Questions (PYQs) for GATE DA: 3+ Solved Questions with Step-by-Step Solutions

    Solve 3+ Elementary Sorting Algorithms previous year questions for GATE DA with answers and detailed solutions. Free sample questions below.

    A question from this chapter

    Question 1
    Consider the problem of sorting the given array in ascending order:

    P = [1, 2, 3, 5, 4]

    Consider two sorting algorithms Bubble Sort (BS) and Insertion Sort (IS).

    Let N1 be the total number of comparisons done by BS on the elements of P and N2 be the total number of comparisons done by IS on the elements of P.

    Which of the following options is/are correct?
    Question 2
    Consider the following sorting algorithms:
    Bubble sort
    Insertion sort
    Selection sort
    Which ONE among the following choices of sorting algorithms sorts the numbers
    in the array [4, 3, 2, 1, 5] in increasing order after exactly two passes over the array?
    Question 3

    Suppose that insertion sort is applied to the array and it takes exactly two swaps to sort the array. Select all possible values of .

    Free preview ends here

    Login to view the complete previous-year questions and solutions

    Creating an account is free. You get the rest of this chapter, step-by-step solutions, and a study plan built around the topics you are actually weak at.

    Why MastersUp

    Personalised first. High quality throughout.

    Most platforms hand everyone the same content. Here the content moves with your performance, topic by topic.

    Built around you, not around a syllabus PDF

    Every answer you give moves your topic-level intelligence rate. The next question, the next revision card and tomorrow's plan all change with it.

    Revision that hits your weak spots

    We only revise topics you have actually attempted and are still below the safe bar on — never the same chapter on repeat.

    Questions calibrated to the real exam

    Each question carries a measured toughness. You are served a rung above your current level, so practice keeps stretching you.

    Notes written for recall, not for volume

    Full lesson cards for first study, curated short-note cards for the last mile — with derivations, traps and exam patterns marked.

    One place for everything

    Notes, chapter practice, previous-year questions, test series and full-length papers — all feeding one picture of your preparation.

    Honest progress

    No vanity streaks. Progress here means chapters mastered and accuracy that held up on harder questions.

    Unlock the whole course

    Full notes and short notes, the complete question bank with worked solutions, mock tests, full-length papers, and an adaptive plan that rebuilds itself as you improve.