• retagged by
513 views
1 1 vote
A sorting algorithm is stable if duplicate elements remain in the same relative position after sorting.

What is the meaning of this statement

1 Answer

Best answer
2 2 votes
let ...original seuence is this....

5 9 3(index2) 4  2 6 3(index 6)....

after sorting..

2  3(index2) 3(index 6) 4 5 6 8...Stable....

2  3(index6) 3(index 2) 4 5 6 8...not...Stable....
• selected by
Position:
Show:

Related questions

8 8 votes
6 6 answers
3.9k
3.9k views
Arjun asked Feb 27, 2025
3,907 views
Suppose that insertion sort is applied to the array $[1,3,5,7,9,11, x, 15,13]$ and it takes exactly two swaps to sort the array. Select all possible values of $x$.$10$$12...
0 0 votes
1 1 answer
112
112 views
GO Classes asked Aug 25
112 views
Let $P$ be the problem of sorting $n\geq1$ elements using only comparisons.Consider the class of all comparison-based algorithms that correctly solve $P$.What is the asym...
3 3 votes
2 2 answers
231
231 views
GO Classes asked Aug 12
231 views
You are given an initial array:$[22,10,14,37,14,4,3]$For the following array, indicate which sorting algorithm could produce this state after an iteration has completed:$...
2 2 votes
2 2 answers
199
199 views
GO Classes asked Aug 12
199 views
Which algorithm-design strategies can reasonably describe Bubble Sort?Greedy Brute force Decrease-and-conquer Divide-and-conquer Dynamic programming