Skip to main contentSkip to solution

In ______________, the smallest element is selected from the unsorted array and swapped with the leftmost element, and that element becomes a part of the sorted array. The process continues for the next element in the unsorted array till the list is sorted.

Solution

✅ Correct Option: 2

Selection sort splits the array into a sorted part and an unsorted part. In each pass it finds the smallest element in the unsorted part and swaps it with the leftmost unsorted element, which then joins the sorted part. This repeats until the list is sorted.


Insertion sort: also keeps a sorted and an unsorted part, but it takes the next element in order and inserts it into its correct place in the sorted part, instead of searching for the smallest.

Bubble sort: repeatedly swaps adjacent out-of-order elements, so the largest element "bubbles" to the end. It does not select a minimum.

Selection sort always makes n−1n - 1 passes and at most n−1n - 1 swaps, which is fewer swaps than bubble or insertion sort.

Keyboard Shortcuts

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