The technique that sorts an array by comparing adjacent elements and swapping them if they are unordered is __________.
The technique that sorts an array by comparing adjacent elements and swapping them if they are unordered is __________.
Solution
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.
Related questions:
2025: 3 June Shift 2
2025: 16 May Shift 1
2025: 16 May Shift 1