0
Which is the best sorting algorithm and why?
Like which algorithm takes the least time and space complexity and ??
2 odpowiedzi
+ 3
It depends on the situation.
@Martine
Quick sort is likely best performing when the elements are randomly sorted before hand.
Quick sort is not that fast when the list is already almost sorted. Although, it does have very good average performance.
@Shubham
So the answer is, under what situation?
Here's a great website comparing lots of algorithms under certain conditions.
(Animated)
https://www.toptal.com/developers/sorting-algorithms
0
Quicksort is the best. Its complexity is n*log(n).