Open In App
Related Articles

ISRO | ISRO CS 2015 | Question 12

Improve Article
Save Article
Like Article

A machine needs a minimum of 100 sec to sort 1000 names by quick sort. The minimum time needed to sort 100 names will be approximately
(A) 50.2 sec
(B) 6.7 sec
(C) 72.7 sec
(D) 11.2 sec

Answer: (B)

Explanation: Best case time complexity of quick sort to take the minimum time to sort names = O(n log n)

let t1 = time taken to sort 1000 names = 100 sec;
n1=1000 names
let t2 = time taken to sort 100 names;
n2= 100 names

t1/t2 = n1*log(n1) / n2*log(n2) 
100/t2 = 1000*log(1000) / 100*log(100)
100/t2 = 10*log(1000) / log(100)
100/t2 = 10*3 / 2
t2 = 20/3 = 6.66 

Option (B) is correct

Quiz of this Question

Whether you're preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape, GeeksforGeeks Courses are your key to success. We provide top-quality content at affordable prices, all geared towards accelerating your growth in a time-bound manner. Join the millions we've already empowered, and we're here to do the same for you. Don't miss out - check it out now!

Last Updated : 03 Apr, 2018
Like Article
Save Article
Similar Reads