Sorting algorithms are important for computer science. Sorting algorithms compare data, in some cases, we have to sort a large amount data. Sorting algorithms are ranked according to their efficiency as the input size grows how the run time is effected.
Most algorithms have a efficiency of O(n^2) or O(nlog(n)) (like pythons builin sort function)
Many algorithms that have the same efficiency dont have the same speed on the same input. Firstly, many algorithms are judged on their average case,
best case, and worst case efficiency. Some algorithms, (i.e. quick sort) are very quick for some inputs, but horribly slow for others. Other
algorithms, (i.e. merge sort) are unaffected by the order of input data due to the way they function and sort.
Even a modified version of bubble sort can finish in O(n) in the best case.
No comments:
Post a Comment