Dear all,
What is better in C++ sort()
or stable_sort()
?
Thanks
№ | Пользователь | Рейтинг |
---|---|---|
1 | tourist | 4009 |
2 | jiangly | 3823 |
3 | Benq | 3738 |
4 | Radewoosh | 3633 |
5 | jqdai0815 | 3620 |
6 | orzdevinwang | 3529 |
7 | ecnerwala | 3446 |
8 | Um_nik | 3396 |
9 | ksun48 | 3390 |
10 | gamegame | 3386 |
Страны | Города | Организации | Всё → |
№ | Пользователь | Вклад |
---|---|---|
1 | cry | 167 |
2 | Um_nik | 163 |
3 | maomao90 | 162 |
3 | atcoder_official | 162 |
5 | adamant | 159 |
6 | -is-this-fft- | 158 |
7 | awoo | 157 |
8 | TheScrasse | 154 |
9 | Dominater069 | 153 |
9 | nor | 153 |
Название |
---|
sort()
is faster, but it doesn't support stability as opposed tostable_sort()
And what is better map or set ?
And what is better coffee or tea?
And what is better Mars or Snickers ?
And what is better boys or girls?
And what is better hands or legs ?
And what is better Real or Barcelona?
And what is better Pepsi or Cola ?
And what is better Ferrari or Maserati? (Actually, I have both)
Good for you! And what is better Alex_KPR or MikeMirzayanov ?
And what is better left_shift or right_shift?
And what is better читать чужие смс или знать где находится твоя вторая половинка?
Смотреть онлайн без регистрации!
So, now it is clear that
sort()
is better!1) As it is already said, stable_sort is stable.
2) stable_sort is faster, if your campare operation is slow
I think stable_sort uses mergesort, and total number of compare operations used is less.