Master Mathematics.

Programming · Searching, Sorting & Complexity · Problem 3

Sorted after exactly two passes

Consider (i) Bubble sort, (ii) Insertion sort, (iii) Selection sort. Which of them sorts the array [4, 3, 2, 1, 5] in increasing order after exactly two passes over the array?

  1. (A) (i) only
  2. (B) (iii) only
  3. (C) (i) and (iii) only
  4. (D) (ii) and (iii) only

Source: GATE DA