Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
@jirehstudios As @polo123qwe said, some are more efficient for different types of data (e.g. if you know most of the data is already sorted or not). Additionally, some exist just because they are easy to implement/understand and others exist just because... well... because we're programmers and we make whatever the heck we want.
-
RenCloud248yAnd some sort algorithm are not stable ->
A sorting algorithm is stable if whenever there are two records R and S with the same key and with R appearing before S in the original list, R will appear before S in the sorted list.
And as example one of the fastes quicksort is an unstable sort -
@jirehstudios in exmaple. Quicksort is devastatingly slow if set is almost sorted (or sorted). It's worst case complexity is O(n^2). But in average it is the fastest :)
Sorting algorithms visualized
undefined
just had a big o right there
ah that sorts it out