A machine needs a minimum of 100 seconds to sort 1000 names by quick sort. The minimum time needed to sort 100 names will be approximately
Explanation
The average-case time complexity of the Quick Sort algorithm is O(nlogn). To find the approximate time for a different number of elements, we can use the ratio of the complexities.
Let T1 be the time for n1 elements and T2 be the time for n2 elements. The relationship is proportional to nlogn:
T2T1≈n2logn2n1logn1
Given data:
Calculation:
Substituting the values into the equation:
T2100≈100log101001000log101000
T2100≈100×21000×3
T2100≈2003000=15
T2≈15100≈6.66 seconds
Rounding to the nearest provided option, we get approximately 6.7 seconds.
Correct Option: (A) 6.7 seconds