____________ is the simplest sorting algorithm that works by repeatedly swapping the adjacent elements in case they are unordered in n-1 passes.
____________ is the simplest sorting algorithm that works by repeatedly swapping the adjacent elements in case they are unordered in n-1 passes.
Solution
Bubble Sort 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. For n elements, n-1 passes are enough to sort the list.
Insertion Sort: picks one element at a time and inserts it into its place in the sorted part, by shifting elements rather than repeatedly swapping adjacent pairs.
Selection Sort: finds the minimum of the unsorted part and places it at the front with a single swap per pass.
Merge Sort: a divide and conquer algorithm that splits the list and merges sorted halves, so it does not work by adjacent swaps.
Related questions:
2025: 3 June Shift 2
2026: 26 May Shift 1