Skip to main contentSkip to solution

Consider the given array:

[15,10,12,11]

What will be the position of the following elements in the array after the first pass using the selection sort?

A. 15

B. 10

C. 12

D. 11

Solution

✅ Correct Option: 3

In the first pass of selection sort, the smallest element of the whole array is found and swapped with the element at the first position. Nothing else is moved.

The smallest element is 1010, at index 1. Swapping it with 1515 at index 0 gives [10,15,12,11][10, 15, 12, 11].

So the positions from first to last are 1010 (B), 1515 (A), 1212 (C), 1111 (D).


Option 1: this would need 1212 and 1111 to swap as well, but selection sort makes only one swap per pass, so they stay in their original order.

Keyboard Shortcuts

  • Left arrow: Previous question
  • Right arrow: Next question
  • S key: Jump to solution
  • Q key: Jump to question