Home > Mobile >  Implementation of stable_sort in python
Implementation of stable_sort in python

Time:10-22

In c there is a function stable_sort() function (It preserves the order ) .Is there any function in python like this ?

CodePudding user response:

list.sort() is stable. From the documentation:

The sort() method is guaranteed to be stable. A sort is stable if it guarantees not to change the relative order of elements that compare equal — this is helpful for sorting in multiple passes (for example, sort by department, then by salary grade).

  • Related