Discuss how you would select an algorithm to sort a list of

Discuss how you would select an algorithm to sort a list of integers? a) What properties of the integers that form the list or the list itself might affect the choice of the algorithm? Explain, b) Present three classes of inputs for which you would select different algorithms. Which algorithms would you select and why? Partial credit will be given if you present two classes of inputs, identify for them appropriate sorting algorithms and justify your selection

Solution

Answer   

     

maxValue is larger than n, and possibly much larger
I don\'t care if the output list is sorted or not
all integers must be chosen with equal probabilit


most evaluations report that the fastest sorts on average are quicksort, or radixsort (aka bucket sort).

But in the worst case, quicksort is very bad. Timsort, mentioned below, does decent damage control, but I\'d be surprised if it is fastest in the worst case.Though the worst case complexity is O(n^2), on an average it gives us O(nlogn) time complexity.

Radixsort may win in the worst case, but if you want a comparison-based sort, my money would actually be on mergesort.

Assume we are sorting a list or array of N elements
Once sorted, smaller items are on the left (first item) and larger items are on the right (last item).
  

 Discuss how you would select an algorithm to sort a list of integers? a) What properties of the integers that form the list or the list itself might affect the

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site