............ compares neighbouring elements only and swaps them when necessary.

2025

............ compares neighbouring elements only and swaps them when necessary.

  1. A.

    Selection Sort

  2. B.

    Bubble Sort

  3. C.

    Insertion Sort

  4. D.

    Quick Sort

Attempted by 653 students.

Show answer & explanation

Correct answer: B

The correct answer is Bubble Sort. This algorithm works by repeatedly stepping through the list to be sorted. It compares each pair of adjacent (neighboring) elements. If they are in the wrong order, it swaps them. This process is repeated until no swaps are needed, indicating the list is sorted.

Explore the full course: Bpsc