Answer Posted / mr. x
Lots of ppl asked, nobody had a clue.
The best sorting algorithm on average depends on the data to
be sorted. If the data is more or less well evenly
distributed, the best sorting algorithm is Radixsort or
Bucketsort, with average and worst cases of O(n).
Next are a class of very complex algorithms (impractical)
which are O(n log log n).
Next are the O(n log n) algorithms. Mergesort and Heapsort
both show average and worst case complexities of O(n log n).
Quicksort is to be avoided as the plague!!!!! It has
non-deterministic complexity and has a worst-case behaviour
of O(n^2). No wonder why there are so many crappy
applications out there.
Then Shellsort is pretty good for small-to-medium lists, as
long as you choose the best gaps (around O(n log^2 n)).
Otherwise it can perform O(n^4/3) or even O(n^2)!.
All other sorts are to be avoided, except for very specific
cases or when simplicity is far more important than code
velocity.
| Is This Answer Correct ? | 10 Yes | 4 No |
Post New Answer View All Answers
What is minimum depth of binary tree?
When is a graph said to be weakly connected?
State the rules to be followed during infix to postfix conversions?
What is range search?
What is a data structure definition?
Define dynamic data structures?
Can hashset contain null?
Is arraylist faster than array?
How memory is reserved using a declaration statement ?
Define avl tree?
How to sort 1 million floating point numbers?
What is the difference between array sort () and array sort t >()?
What is a directed graph?
Define articulation point?
Describe linear probing with an example.