Which sorting algorithm is not stable?

Practice Questions

Q1
Which sorting algorithm is not stable?
  1. Bubble Sort
  2. Merge Sort
  3. Insertion Sort
  4. Quick Sort

Questions & Step-by-Step Solutions

Which sorting algorithm is not stable?
  • Step 1: Understand what a sorting algorithm is. A sorting algorithm is a method used to arrange elements in a specific order, like ascending or descending.
  • Step 2: Learn about stability in sorting algorithms. A stable sorting algorithm maintains the relative order of equal elements (elements that are the same).
  • Step 3: Identify examples of stable sorting algorithms, such as Bubble Sort and Merge Sort, which keep equal elements in their original order.
  • Step 4: Now, look at Quick Sort. Quick Sort is a popular sorting algorithm that can rearrange equal elements, meaning it does not guarantee to keep their original order.
  • Step 5: Conclude that Quick Sort is not a stable sorting algorithm because it can change the relative order of equal elements.
No concepts available.
Soulshift Feedback ×

On a scale of 0–10, how likely are you to recommend The Soulshift Academy?

Not likely Very likely