Skip to content
Official PYQ · 2010

GATE CS 2010 Q12 — Asymptotic Worst Case Time and Space Complexity

Explain with AI

Two alternative packages AA and BB are available for processing a database having 10k10^k records. Package AA requires 0.0001n20.0001 n^2 time units and package BB requires 10nlog⁡10n10n\log_{10} n time units to process nn records. What is the smallest value of kk for which package BB will be preferred over AA?

Choose one option
View worked solution

Answer: C

We are given the database size n=10kn = 10^k.

The time required by the two packages to process nn records is:

  • Package A: TA(n)=0.0001n2=10−4n2T_A(n) = 0.0001 n^2 = 10^{-4} n^2
  • Package B: TB(n)=10nlog⁡10nT_B(n) = 10 n \log_{10} n

Package BB is preferred over Package AA when it takes strictly less time, i.e.,

TB(n)<TA(n)T_B(n) < T_A(n)

Substitute the expressions for TA(n)T_A(n) and TB(n)T_B(n):

10nlog⁡10n<10−4n210 n \log_{10} n < 10^{-4} n^2

Since n=10k≥1n = 10^k \ge 1, we can divide both sides by nn:

10log⁡10n<10−4n10 \log_{10} n < 10^{-4} n

Now, substitute n=10kn = 10^k into the inequality:

10log⁡10(10k)<10−4⋅10k10 \log_{10}(10^k) < 10^{-4} \cdot 10^k10⋅k<10k−410 \cdot k < 10^{k-4}

Let us test the integer values of kk starting from the options:

  • For k=5k = 5: 10(5)<105−4  ⟹  50<10(False)10(5) < 10^{5-4} \implies 50 < 10 \quad \text{(False)}
  • For k=6k = 6: 10(6)<106−4  ⟹  60<100(True)10(6) < 10^{6-4} \implies 60 < 100 \quad \text{(True)}

Thus, the smallest integer value of kk for which Package BB is preferred over Package AA is 66.

Free practice · Your answers on this page are not saved.

Published
Report a correction
Keep exploringMore Asymptotic Worst Case Time and Space Complexity questions