Which sorting algorithm is the most efficient one? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Which sorting algorithm is the most efficient one?

bubblesort? or quicksort or insertionsort?

15th Feb 2017, 9:26 PM
Hermann Set
Hermann Set - avatar
1 Answer
+ 2
Depends on how big your data. In general, any sort that achieves O(n*log n) "on average" is considered efficient for sufficiently large data (i.e. n>=1000000). In that case, quicksort wins. Now if you're monkeying around with a few elements (i.e. n=1000), either bubblesort or intersionsort will win. But efficiency depends on what you want to do and how many elements you're trying to sort. So to help you out, here's a cheat sheet that can help you decide what may/may not be right for you: http://bigocheatsheet.com/
15th Feb 2017, 9:39 PM
M King
M King - avatar