Each programmer must have a wide range of sorting algorithms. Despite the fact that, on average, fast sorting is optimal, it is not the best in all cases. For example, when sorting very small lists (for example, fewer than 100 items), the additional amount of work created by recursive quick sort calls can outweigh the advantages of its better algorithm. In such rare cases, one of their simple sorting methods — perhaps even bubble sorting — can work faster. In addition, if it’s known that the list is almost orderly, or if you don’t want to rearrange the same keys, some other algorithm will work better than a quick sort. The essence of the above is that just the fact that quick sorting is the best general-purpose algorithm does not mean that in specific cases other approaches will not give better results.
Comments
To leave a comment
Algorithms
Terms: Algorithms