To sort the list
which algorithm is faster?
This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try
refreshing the page, (b) enabling javascript if it is disabled on your browser and,
finally, (c)
loading the
non-javascript version of this page
. We're sorry about the hassle.
Mergesort takes O ( n l g n ) time no matter the input. Bubble Sort takes O ( n 2 ) time when the input is not already sorted. Insertion Sort takes O ( n 2 ) when the input is relatively unordered since its average and worst case is O ( n 2 ) . The best case for Insertion Sort is O ( n ) , but in order to achieve this running time, the input must already be fairly ordered. This input list is not sorted or close to sorted, so Mergesort is the fastest algorithm to sort this input.