Skip to content
GATEiit

GATE DA 2026 Q49: Comparisons by bubble sort and insertion sort on a nearly sorted array

Question

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?

Try it: multiple select: one or more correct options

Select one or more options
Select all correct options. No negative marking, no partial marks.
Show answer and explanation

Answer: B, C, D (official GATE 2026 final answer key)

Concept used: Bubble sort compares adjacent pairs pass after pass; insertion sort compares each new element only until it finds its place.

First step: Insertion sort makes 1 + 1 + 1 + 2 = 5 comparisons and one swap; bubble sort needs at least a second pass to confirm the array is sorted.

Full step-by-step solution

Detailed working, common mistakes and linked mock tests will be available with a free GATEiit account. Log-in is coming soon.

Share this question

WhatsAppDownload image

Source: official GATE 2026 DA question paper and final answer key, organised by IIT Guwahati. Question paper · Answer key