Q35.Marks: +2.0UGC NET Paper 2: Computer Sc 23rd August 2024 Shift 1
Select the Sorting Algorithms that are stable.
(A) Quick Sort
(B) Bubble Sort
(C) Insertion Sort
(D) Merge Sort
(E) Shell Sort
Choose the correct answer from the options given below:
1.(A), (B), (C) and (E) Only
2.(A), (D) and (E) Only
3.(B) and (C) Only✓ Correct
4.(B), (C) and (E) Only
Solution
The correct answer is (B) and (C) Only
EXPLANATION:
(A) Quick Sort -
This statement is NOT CORRECT. Quick Sort is not a stable sorting algorithm because it does not guarantee that the relative order of equal elements will be preserved.
(B) Bubble Sort -
This statement is CORRECT. Bubble Sort is a stable sorting algorithm because it compares and swaps adjacent elements, thereby preserving the relative order of equal elements.
(C) Insertion Sort -
This statement is CORRECT. Insertion Sort is also a stable sorting algorithm because it inserts elements into their correct position without changing the relative order of equal elements.
(D) Merge Sort -
This statement is NOT CORRECT. While Merge Sort is often implemented as a stable sort, it is not inherently stable. It depends on the implementation.
(E) Shell Sort -
This statement is NOT CORRECT. Shell Sort is not a stable sorting algorithm because it can move elements far distances, potentially altering the relative order of equal elements.