203k views
3 votes
a) You are given an array with 100,000 entries to sort. Under what circumstances would you use each of the following: (i) insertion sort, (ii) mergesort, and (iii) quicksort?

1 Answer

6 votes

Answer:

An array with such a large size should be sorted using Mergesort algorithm

Step-by-step explanation:

Mergesort has worst case complexity of O(nlogn) whereas quicksort algorithm has worstcase complexity of O(
n^(2)). So quicksort works better with smaller arrays and mergesort works better than quicksort in case of larger arrays. Insertion sort is used when array is almost sorted.So, if array is unsorted at greater level, insertion sort should not be used.It also has a worst case complexity of O(
n^(2)).

User Yury Skaletskiy
by
5.2k points