Skip to main contentSkip to solution

The technique that sorts an array by comparing adjacent elements and swapping them if they are unordered is __________.

Solution

✅ Correct Option: 3

Bubble Sort repeatedly compares each pair of adjacent elements and swaps them if they are in the wrong order. After each pass, the largest remaining element "bubbles" to its correct position at the end of the array.


Selection Sort: finds the minimum element in the unsorted part and swaps it into place, rather than comparing adjacent pairs.

Insertion Sort: picks one element at a time and inserts it into its correct position in the sorted part by shifting elements, not by repeatedly swapping adjacent pairs across the whole array.

Bucket Sort: distributes elements into buckets by value range, sorts each bucket, then joins them. It does not compare adjacent elements.

Keyboard Shortcuts

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