Which of the following sorting technique was applied for an input array {10, 5, 16, 2, 8, 9} which gives array {2, 5, 10, 16, 8, 9} after three iterations?
- (A)
Bubble sort
- (B)
Selection sort
- (C)
Insertion sort
- (D)
All of the above
Which of the following sorting technique was applied for an input array {10, 5, 16, 2, 8, 9} which gives array {2, 5, 10, 16, 8, 9} after three iterations?
Bubble sort
Selection sort
Insertion sort
All of the above
ANSWER
The technique is insertion sort, option (C).
Official answer: CSource: ISRO's final answer key of 15 May 2026
The array after three iterations is . The first four elements are sorted and the last two, , are in their original positions.
Bubble sort, pass 1: compare adjacent pairs and swap when out of order, which gives , then , then , then . The largest element is now at the last position and stays there. The target has in the last position, so bubble sort can never produce it. Not bubble sort.
Selection sort: iteration 1 swaps the minimum with , giving . Iteration 2 finds the minimum already in place. Iteration 3 swaps the minimum of , which is , with , giving . This differs from the target. Not selection sort.
Insertion sort treats the first element as a sorted prefix and inserts one new element per iteration. Iteration 1 inserts : . Iteration 2 inserts , already in place: . Iteration 3 inserts at the front, shifting one place right: .
This matches the target exactly, with untouched. Only insertion sort fits, so option (d), all of the above, is wrong.
KEY IDEA
After iterations insertion sort has the first elements sorted and the rest untouched, while selection sort has the smallest elements in final place and bubble sort has the largest at the end.
WATCH OUT FOR
Seeing a sorted prefix and assuming selection sort. Selection sort swaps the minimum into place, which disturbs the other elements (here would move behind ), whereas insertion sort shifts elements and keeps the unsorted tail unchanged.
From the ISRO CS 2025 paper. Every question of this paper · The full paper (PDF, ISRO) · All 3 ISRO Sorting & hashing questions, with notes