1.

A machine needs a minimum of 200 sec to sort 1000 elements by Quick sort. The minimum time needed to sort 200 elements will be approximately __________(a) 60.2 sec(b) 45.54 sec(c) 31.11 sec(d) 20 secThe question was asked in unit test.I need to ask this question from Quicksort topic in division Sorting of Data Structures & Algorithms II

Answer»

Right choice is (c) 31.11 sec

The best I can explain: The Quick sort requires NLOG2N comparisons in best case, where n is size of input ARRAY. So, 1000 * log21000 ≈ 9000 comparisons are required to sort 1000 elements, which takes 200 sec. To sort 200 elements MINIMUM of 200 * log2200 ≈ 1400 comparisons are required. This will take 200 * 1400 / 9000 ≈ 31.11 sec.



Discussion

No Comment Found

Related InterviewSolutions