How can we convert non stable comparison based algorithm to stable algorithm . | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How can we convert non stable comparison based algorithm to stable algorithm .

I read on geeks for geeks that it can be done but nowhere is given how can we do it... mean no illustrative idea of such topics why....

12th Aug 2019, 5:20 PM
Nikhil Tale
Nikhil Tale - avatar
1 Answer
0
It depends on your algorithm. A stable algorithm is holding its order after sorting again, for example: Oder by name: Alex 4 Amber 3 Bryan 3 Cecil 2 David1 If you order with a stable algorithm after numbers, Amber will stay before Bryan. How you implement this, is your challenge. And quicksort as an example is hardly ever stable.
16th Mar 2020, 7:53 AM
Yannick Reiß
Yannick Reiß - avatar