+ 5

# which sorting algorithm is the most efficiency? look at the description for the options.

â˘Bucket sort. â˘Bubble sort. â˘Insertion sort. â˘Selection sort. â˘Heap sort. â˘Merge sort.

6 Answers

+ 9

No Quick sort?

+ 9

It is certainly among the most efficient in time but also space complexity. If you want the exact the solution look at this:
http://quiz.geeksforgeeks.org/time-complexities-of-all-sorting-algorithms/
And if you don't know what time and space complexity is :
https://www.hackerearth.com/practice/basic-programming/complexity-analysis/time-and-space-complexity/tutorial/

+ 8

Quicksort is better for 'randomized' data. The more sorted it is beforehand, the slower the quicksort will be.

+ 4

is quick sort the most efficiency?

+ 4

The Landau expression for time complexity does not tell the whole story though. Even if the expected runtime of two algorithms is in Î¸(n log n), one can be faster by a constant, but huge, factor.
In most cases quicksort will be much faster than heap or mergesort for example. If you have reason to believe your data sets you up for a bad case (does not happen all too often), you should consider using one of the other algorithms though.

0

From the options, merge sort is better for generic purposes. In specific situations, it will depend on the data.