Which sort show the best average behavior?
Answers were Sorted based on User's Feedback
Answer / srinvias
Merge sort. In all the cases the complexity is nlogn
For Quick sort complexity is o(n^2), nlogn in worst and best
cases respectively.
| Is This Answer Correct ? | 14 Yes | 5 No |
Answer / 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 |
Answer / bharath
on avg qsort is O(n) and worst is n^2;
msort is O(nlogn) for all
hsort is same as msort
| Is This Answer Correct ? | 6 Yes | 3 No |
Answer / shiva
obviously quick sort nly provide best avg behavior....
| Is This Answer Correct ? | 4 Yes | 5 No |
Answer / manoj ransing
The worst case behaviour or quick sort is n^2, but that of
heap sort is nlogn. The average case for both is nlogn.
| Is This Answer Correct ? | 3 Yes | 10 No |
What does quick sort do?
Tell us the difference between merge and quick sort. Which one would you prefer and why?
0 Answers Agilent, ZS Associates,
Define 2-3-4 tree?
Why is treeset sorted?
How many different binary trees and binary search trees can be made from three nodes that contain the key values 1, 2 & 3?
28 Answers Accenture, Amazon, College School Exams Tests, iGate, Microsoft, TCS, Wipro,
What is sequential search? What is the average number of comparisons in a sequential search?
Can hashset contain null?
Q # 1 : in which graph algorithm do we start finding vertices that should be first in the topological order and then apploy the fact that every vertex must come before its successors in the topolgical order.
Define in brief an array.
Name some applications which use linked lists.
Write a Program for Linked list manipulation.
Classify the Hashing Functions based on the various methods by which the key value is found.