Discrete Math Quiz: Comparing Growth Rates
19 questions · exam conditions
0:00
Comparing Growth RatesQuestion 1 of 19

For large values of nn, which of the following correctly orders these functions from slowest to fastest asymptotic growth: f1(n)=nlognf_1(n) = n^{\log n}, f2(n)=(logn)nf_2(n) = (\log n)^n, f3(n)=2n0.5f_3(n) = 2^{n^{0.5}}, f4(n)=n!f_4(n) = n!?

f1(n)<f3(n)<f2(n)<f4(n)f_1(n) < f_3(n) < f_2(n) < f_4(n)
f1(n)<f3(n)<f4(n)<f2(n)f_1(n) < f_3(n) < f_4(n) < f_2(n)
f3(n)<f1(n)<f4(n)<f2(n)f_3(n) < f_1(n) < f_4(n) < f_2(n)
f1(n)<f4(n)<f3(n)<f2(n)f_1(n) < f_4(n) < f_3(n) < f_2(n)
← Back to quizzes

Discrete Math Quiz

Discrete Math Quiz: Comparing Growth Rates

Practice Comparing Growth Rates in Discrete Math with focused quiz questions that help you check what you know, review explanations, and build confidence with test-style prompts.

What this quiz covers

This quiz focuses on Comparing Growth Rates, giving you a quick way to practice the rules, question types, and explanations that matter most for Discrete Math.

How to use this quiz

Try each quiz question before looking at the correct answer. Use the explanations to review missed ideas, then come back to similar questions until the pattern feels familiar.

All questions

Question 1

For large values of nn, which of the following correctly orders these functions from slowest to fastest asymptotic growth: f1(n)=nlognf_1(n) = n^{\log n}, f2(n)=(logn)nf_2(n) = (\log n)^n, f3(n)=2n0.5f_3(n) = 2^{n^{0.5}}, f4(n)=n!f_4(n) = n!?

  1. f1(n)<f3(n)<f2(n)<f4(n)f_1(n) < f_3(n) < f_2(n) < f_4(n)
  2. f1(n)<f3(n)<f4(n)<f2(n)f_1(n) < f_3(n) < f_4(n) < f_2(n) (correct answer)
  3. f3(n)<f1(n)<f4(n)<f2(n)f_3(n) < f_1(n) < f_4(n) < f_2(n)
  4. f1(n)<f4(n)<f3(n)<f2(n)f_1(n) < f_4(n) < f_3(n) < f_2(n)
Explanation: We need to compare these functions asymptotically. First, f1(n)=nlogn=2lognlogn=2(logn)2f_1(n) = n^{\log n} = 2^{\log n \cdot \log n} = 2^{(\log n)^2}. For f2(n)=(logn)nf_2(n) = (\log n)^n, taking logs: logf2(n)=nlog(logn)\log f_2(n) = n \log(\log n). For f3(n)=2n0.5f_3(n) = 2^{n^{0.5}}, we have logf3(n)=n0.5\log f_3(n) = n^{0.5}. For f4(n)=n!f_4(n) = n!, by Stirling's approximation: logf4(n)nlognn\log f_4(n) \approx n \log n - n. Comparing the exponents: (logn)2(\log n)^2 vs n0.5n^{0.5} vs nlognn \log n vs nlog(logn)n \log(\log n). Since n0.5n^{0.5} grows faster than (logn)2(\log n)^2, nlognn \log n grows faster than n0.5n^{0.5}, and nlog(logn)n \log(\log n) grows faster than nlognn \log n, the order is f1<f3<f4<f2f_1 < f_3 < f_4 < f_2.

Question 2

A programmer implements two sorting algorithms: Algorithm X runs in O(nlogn)O(n \log n) time in the average case but O(n2)O(n^2) in the worst case, while Algorithm Y runs in Θ(nlog2n)\Theta(n \log^2 n) in all cases. For which scenario is the asymptotic analysis most relevant for choosing between these algorithms?

  1. When sorting arrays of size n=100n = 100 with random data, because asymptotic analysis applies best to small inputs
  2. When comparing algorithms on different hardware architectures where implementation details vary significantly
  3. When sorting arrays of size n=50n = 50 where constant factors and lower-order terms dominate the runtime
  4. When sorting arrays of size n=106n = 10^6 with adversarially chosen data that triggers worst-case behavior (correct answer)
Explanation: When analyzing algorithm complexity, asymptotic analysis becomes most meaningful when input sizes are large enough that the dominant terms overshadow constant factors and lower-order terms, and when you're dealing with realistic worst-case scenarios that could actually occur. Algorithm X has average-case O(nlogn)O(n \log n) but worst-case O(n2)O(n^2), while Algorithm Y consistently runs in Θ(nlog2n)\Theta(n \log^2 n). With n=106n = 10^6 and adversarial data triggering the worst case, Algorithm X would perform roughly n2=1012n^2 = 10^{12} operations, while Algorithm Y performs about nlog2n=106×(log106)2106×400=4×108n \log^2 n = 10^6 \times (\log 10^6)^2 \approx 10^6 \times 400 = 4 \times 10^8 operations. This dramatic difference makes the asymptotic analysis highly relevant for choosing Algorithm Y. Choice A misunderstands when asymptotic analysis matters—it's most useful for large inputs, not small ones. Choice B is incorrect because asymptotic analysis abstracts away implementation details and hardware differences, focusing on the fundamental growth rates. Choice C correctly identifies that constant factors dominate for small inputs like n=50n = 50, but this actually makes asymptotic analysis less relevant, not more. Remember that asymptotic analysis shines when input sizes are large enough that growth rates matter more than constants, and when you're considering realistic scenarios. For exam questions, look for large nn values combined with conditions that could realistically occur in practice.

Question 3

An algorithm's running time is measured for various input sizes, yielding T(n)=3n3+100n2logn+50n2+1000nT(n) = 3n^3 + 100n^2\log n + 50n^2 + 1000n. If we want to classify this algorithm's time complexity using the tightest possible big-theta bound, what is the correct classification?

  1. Θ(n3+n2logn)\Theta(n^3 + n^2\log n) because we must include all significant terms in the bound
  2. Θ(n3)\Theta(n^3) because the cubic term dominates all other terms asymptotically (correct answer)
  3. Θ(n2logn)\Theta(n^2\log n) because the coefficient 100 makes this term larger than 3n33n^3 for practical values
  4. Θ(n3logn)\Theta(n^3\log n) because we multiply the highest degree term by the logarithmic factor
Explanation: In asymptotic analysis, we keep only the fastest-growing term. Since n3n^3 grows faster than n2lognn^2\log n, n2n^2, and nn for sufficiently large nn, the tightest big-theta bound is Θ(n3)\Theta(n^3). Choice A incorrectly includes lower-order terms. Choice C makes the common error of being misled by large coefficients - asymptotic analysis ignores constants. Choice D incorrectly combines the highest degree with a logarithmic factor that doesn't apply here.

Question 4

A recursive algorithm satisfies the recurrence relation T(n)=4T(n/2)+n2lognT(n) = 4T(n/2) + n^2\log n with T(1)=1T(1) = 1. Using the Master Theorem, what is the asymptotic time complexity?

  1. Θ(n2logn)\Theta(n^2\log n) because f(n)=n2lognf(n) = n^2\log n dominates nlog24=n2n^{\log_2 4} = n^2
  2. Θ(n2log2n)\Theta(n^2\log^2 n) because we're in case 2 of Master Theorem with k=1k = 1 (correct answer)
  3. Θ(n2logn)\Theta(n^2\log n) because the recursion cost equals the work per level
  4. Θ(n2)\Theta(n^2) because the polynomial term n2n^2 in f(n)f(n) matches nlogban^{\log_b a}
Explanation: We have a=4a = 4, b=2b = 2, so nlogba=n2n^{\log_b a} = n^2. The function f(n)=n2lognf(n) = n^2\log n. Since f(n)=Θ(n2logkn)f(n) = \Theta(n^2\log^k n) with k=1>0k = 1 > 0, we're in case 2 of the Master Theorem, giving T(n)=Θ(n2logk+1n)=Θ(n2log2n)T(n) = \Theta(n^2\log^{k+1} n) = \Theta(n^2\log^2 n). Choice A fails to account for the extra log factor from case 2. Choice C gives an intuitive but incorrect analysis. Choice D ignores the logarithmic factor in f(n)f(n).

Question 5

Functions f1(n)=n2+1000nlognf_1(n) = n^2 + 1000n\log n, f2(n)=999n2f_2(n) = 999n^2, and f3(n)=n2+n1.9f_3(n) = n^2 + n^{1.9} are given. Which statement about their asymptotic relationships is correct?

  1. f2(n)=O(f1(n))f_2(n) = O(f_1(n)) and f1(n)=O(f3(n))f_1(n) = O(f_3(n)), but f2(n)f_2(n) and f3(n)f_3(n) are incomparable
  2. f1(n)=Θ(f2(n))=Θ(f3(n))f_1(n) = \Theta(f_2(n)) = \Theta(f_3(n)) because all three functions are quadratic
  3. f3(n)=O(f1(n))=O(f2(n))f_3(n) = O(f_1(n)) = O(f_2(n)) with f1(n)f_1(n) growing fastest asymptotically
  4. f2(n)=O(f1(n))=O(f3(n))f_2(n) = O(f_1(n)) = O(f_3(n)) with both f1(n)f_1(n) and f3(n)f_3(n) growing faster than f2(n)f_2(n) (correct answer)
Explanation: All three functions are Θ(n2)\Theta(n^2), but we need to examine their relative growth. f2(n)=999n2f_2(n) = 999n^2 is pure quadratic. f1(n)=n2+1000nlognf_1(n) = n^2 + 1000n\log n has an additional nlognn\log n term that makes it grow slightly faster. f3(n)=n2+n1.9f_3(n) = n^2 + n^{1.9} has an additional n1.9n^{1.9} term that also makes it grow faster than pure quadratic. Both f1f_1 and f3f_3 eventually dominate f2f_2, so f2=O(f1)f_2 = O(f_1) and f2=O(f3)f_2 = O(f_3). Choice B is too coarse (not tight bounds). Choice C reverses some relationships. Choice A makes an incorrect incomparability claim.

Question 6

Consider three algorithms with time complexities A(n)=n!A(n) = n!, B(n)=22nB(n) = 2^{2^n}, and C(n)=nlognC(n) = n^{\log n}. For sufficiently large nn, what is the correct ordering of these functions from slowest to fastest growing?

  1. C(n)<A(n)<B(n)C(n) < A(n) < B(n) because double exponentials grow faster than factorials, which grow faster than quasi-polynomial functions (correct answer)
  2. A(n)<C(n)<B(n)A(n) < C(n) < B(n) because nlognn^{\log n} grows faster than n!n! due to the logarithmic exponent
  3. C(n)<B(n)<A(n)C(n) < B(n) < A(n) because factorials grow faster than any exponential function
  4. A(n)<B(n)<C(n)A(n) < B(n) < C(n) because nlogn=(logn)nn^{\log n} = (\log n)^n which grows faster than double exponentials
Explanation: Using Stirling's approximation, n!2πn(n/e)nn! \approx \sqrt{2\pi n}(n/e)^n, so factorial is roughly exponential in nn. The function 22n2^{2^n} is double exponential and grows much faster than any single exponential. Meanwhile, nlogn=2(logn)2n^{\log n} = 2^{(\log n)^2} is quasi-polynomial, growing faster than any polynomial but slower than exponential functions. Choice B incorrectly orders factorial and quasi-polynomial. Choice C wrongly claims factorial grows faster than double exponential. Choice D misapplies the identity nlogn=(logn)nn^{\log n} = (\log n)^n (which is false) and overestimates quasi-polynomial growth.

Question 7

An algorithm processes data in phases, where phase kk requires n22k\frac{n^2}{2^k} operations for k=1,2,3,k = 1, 2, 3, \ldots until n22k<1\frac{n^2}{2^k} < 1. What is the total number of operations as a function of nn?

  1. Θ(n2logn)\Theta(n^2\log n) because there are logn\log n phases each requiring Θ(n2)\Theta(n^2) operations
  2. Θ(n2logn)\Theta(n^2\log n) because each phase takes substantial time and there are logarithmically many phases
  3. Θ(n2)\Theta(n^2) because the geometric series k=1lognn22k\sum_{k=1}^{\log n} \frac{n^2}{2^k} is dominated by the first term (correct answer)
  4. Θ(n2/logn)\Theta(n^2/\log n) because the average work per phase is n2n^2 divided by the number of phases
Explanation: When analyzing algorithms with multiple phases where work decreases geometrically, you need to carefully evaluate the sum of all phases rather than making assumptions based on the number of phases alone. The algorithm runs until n22k<1\frac{n^2}{2^k} < 1, which means 2k>n22^k > n^2, so k>log2(n2)=2log2(n)k > \log_2(n^2) = 2\log_2(n). This gives us approximately 2logn2\log n phases. The total work is k=12lognn22k=n2k=12logn12k\sum_{k=1}^{2\log n} \frac{n^2}{2^k} = n^2 \sum_{k=1}^{2\log n} \frac{1}{2^k}. This geometric series equals n21/2(1/2)2logn+111/2=n2(1(1/2)2logn)n^2 \cdot \frac{1/2 - (1/2)^{2\log n + 1}}{1 - 1/2} = n^2(1 - (1/2)^{2\log n}). Since (1/2)2logn=1n2(1/2)^{2\log n} = \frac{1}{n^2}, the sum approaches n2(11n2)=n21=Θ(n2)n^2(1 - \frac{1}{n^2}) = n^2 - 1 = \Theta(n^2). The first term n22\frac{n^2}{2} dominates all subsequent terms combined. Choice A incorrectly multiplies the number of phases by the work in the first phase, ignoring that later phases do much less work. Choice B makes the same error with vaguer reasoning about "substantial time" per phase. Choice D incorrectly computes an average and divides, which has no mathematical basis for this type of sum. Study tip: In geometric series where terms decrease rapidly, the sum is typically dominated by the first few terms, not by the number of terms. Always compute the actual sum rather than assuming it's proportional to the number of terms times the largest term.

Question 8

An algorithm's running time is modeled by T(n)=n1+sin(logn)T(n) = n^{1 + \sin(\log n)}. Which statement about the asymptotic behavior of this function is most accurate?

  1. T(n)=Θ(n)T(n) = \Theta(n) because the oscillating term averages to a constant over time
  2. T(n)=O(n2)T(n) = O(n^2) and T(n)=Ω(1)T(n) = \Omega(1), but T(n)T(n) is not Θ\Theta of any polynomial (correct answer)
  3. T(n)=Θ(n1.5)T(n) = \Theta(n^{1.5}) because sin(logn)\sin(\log n) is bounded and averages to approximately 0.50.5
  4. The function has no meaningful asymptotic bound because the oscillatory behavior prevents standard analysis
Explanation: Since sin(logn)\sin(\log n) oscillates between 1-1 and 11, we have n11n1+sin(logn)n1+1n^{1-1} \leq n^{1+\sin(\log n)} \leq n^{1+1}, which gives 1T(n)n21 \leq T(n) \leq n^2. Therefore T(n)=O(n2)T(n) = O(n^2) and T(n)=Ω(1)T(n) = \Omega(1). However, T(n)T(n) is not Θ\Theta of any specific polynomial because the exponent 1+sin(logn)1 + \sin(\log n) oscillates infinitely often between values close to 00 and 22. Choice A is wrong because averaging doesn't apply to asymptotic analysis this way. Choice C is wrong because the average value is irrelevant for big-Θ\Theta bounds. Choice D is wrong because we can still establish upper and lower bounds.

Question 9

Two functions f(n)f(n) and g(n)g(n) satisfy f(n)=O(g(n))f(n) = O(g(n)) and g(n)=O(f(n))g(n) = O(f(n)). A student concludes that f(n)2=Θ(g(n)2)f(n)^2 = \Theta(g(n)^2). Which assessment of this reasoning is correct?

  1. The conclusion is correct because f(n)=Θ(g(n))f(n) = \Theta(g(n)) implies f(n)2=Θ(g(n)2)f(n)^2 = \Theta(g(n)^2) by the properties of big-Theta notation (correct answer)
  2. The conclusion is incorrect because squaring functions can change their asymptotic relationships unpredictably
  3. The conclusion is correct only if both f(n)f(n) and g(n)g(n) are eventually positive and monotonic functions
  4. The conclusion is incorrect because the squaring operation requires additional regularity conditions not given in the problem
Explanation: Since f(n)=O(g(n))f(n) = O(g(n)) and g(n)=O(f(n))g(n) = O(f(n)), we have f(n)=Θ(g(n))f(n) = \Theta(g(n)). This means there exist positive constants c1,c2c_1, c_2 such that c1g(n)f(n)c2g(n)c_1 g(n) \leq f(n) \leq c_2 g(n) for sufficiently large nn. Squaring all parts (assuming functions are eventually positive, which is standard in asymptotic analysis): c12g(n)2f(n)2c22g(n)2c_1^2 g(n)^2 \leq f(n)^2 \leq c_2^2 g(n)^2. Therefore f(n)2=Θ(g(n)2)f(n)^2 = \Theta(g(n)^2). Choice B is wrong because squaring preserves asymptotic relationships for positive functions. Choice C is unnecessarily restrictive since monotonicity isn't required. Choice D is wrong because no additional conditions are needed beyond the standard assumption of eventual positivity.

Question 10

Consider the function G(n)=i=1n1i1.1G(n) = \sum_{i=1}^n \frac{1}{i^{1.1}}. Which statement most accurately describes the asymptotic behavior of G(n)G(n)?

  1. G(n)=Θ(logn)G(n) = \Theta(\log n) because the sum behaves similarly to the harmonic series for large nn
  2. G(n)=Θ(n0.1)G(n) = \Theta(n^{-0.1}) because the largest term 1n1.1\frac{1}{n^{1.1}} dominates the asymptotic behavior
  3. G(n)=Θ(1)G(n) = \Theta(1) because the series i=11i1.1\sum_{i=1}^\infty \frac{1}{i^{1.1}} converges to a finite constant (correct answer)
  4. G(n)=Θ(n0.9)G(n) = \Theta(n^{0.9}) because integration approximation gives 1nx1.1dx=n0.110.1\int_1^n x^{-1.1} dx = \frac{n^{-0.1} - 1}{-0.1}
Explanation: The series i=1n1i1.1\sum_{i=1}^n \frac{1}{i^{1.1}} is a p-series with p=1.1>1p = 1.1 > 1, so the infinite series i=11i1.1\sum_{i=1}^\infty \frac{1}{i^{1.1}} converges to some finite constant CC. This means G(n)=i=1n1i1.1CG(n) = \sum_{i=1}^n \frac{1}{i^{1.1}} \to C as nn \to \infty, so G(n)=Θ(1)G(n) = \Theta(1). Choice A is wrong because this isn't like the harmonic series (which has p=1p = 1). Choice B is wrong because individual terms don't determine the sum's behavior when the series converges. Choice D correctly computes the integral but misapplies it - when the integral converges, the sum approaches a constant, not the integral value.

Question 11

Consider the functions f(n)=n2lognf(n) = n^2 \log n and g(n)=n2.1g(n) = n^{2.1}. For which of the following statements about their asymptotic growth rates is true?

  1. f(n)=O(g(n))f(n) = O(g(n)) but g(n)O(f(n))g(n) \neq O(f(n)), so g(n)g(n) grows strictly faster than f(n)f(n) (correct answer)
  2. g(n)=O(f(n))g(n) = O(f(n)) but f(n)O(g(n))f(n) \neq O(g(n)), so f(n)f(n) grows strictly faster than g(n)g(n)
  3. f(n)=Θ(g(n))f(n) = \Theta(g(n)), so they have the same asymptotic growth rate
  4. Neither function dominates the other asymptotically, as their growth rates are incomparable
Explanation: To compare these functions, we examine limnf(n)g(n)=limnn2lognn2.1=limnlognn0.1\lim_{n \to \infty} \frac{f(n)}{g(n)} = \lim_{n \to \infty} \frac{n^2 \log n}{n^{2.1}} = \lim_{n \to \infty} \frac{\log n}{n^{0.1}}. Since any polynomial (even with fractional exponent) grows faster than any logarithmic function, this limit equals 0. Therefore f(n)=O(g(n))f(n) = O(g(n)). Since the limit is 0 (not infinity), we have g(n)O(f(n))g(n) \neq O(f(n)). Choice B is wrong because it reverses the relationship. Choice C is wrong because f(n)Θ(g(n))f(n) \neq \Theta(g(n)) since the limit is 0, not a positive constant. Choice D is wrong because the functions are comparable - one clearly dominates the other.

Question 12

Functions u(n)u(n) and v(n)v(n) satisfy u(n)=o(v(n))u(n) = o(v(n)). A researcher claims that u(n)+v(n)=Θ(v(n))u(n) + v(n) = \Theta(v(n)) and u(n)v(n)=o(v(n)2)u(n) \cdot v(n) = o(v(n)^2). Which assessment of these claims is correct?

  1. Both claims are correct and follow directly from the properties of little-o notation and asymptotic arithmetic (correct answer)
  2. The first claim is correct but the second is incorrect because multiplication doesn't preserve little-o relationships
  3. The first claim is incorrect because addition can change asymptotic relationships unpredictably when one function dominates
  4. Both claims are incorrect because they require additional assumptions about the functions' eventual positivity and monotonicity
Explanation: Since u(n)=o(v(n))u(n) = o(v(n)), we have limnu(n)v(n)=0\lim_{n \to \infty} \frac{u(n)}{v(n)} = 0. For the first claim: u(n)+v(n)=v(n)(u(n)v(n)+1)=v(n)(o(1)+1)=v(n)(1+o(1))=Θ(v(n))u(n) + v(n) = v(n)(\frac{u(n)}{v(n)} + 1) = v(n)(o(1) + 1) = v(n)(1 + o(1)) = \Theta(v(n)). For the second claim: u(n)v(n)v(n)2=u(n)v(n)=o(1)\frac{u(n) \cdot v(n)}{v(n)^2} = \frac{u(n)}{v(n)} = o(1), so u(n)v(n)=o(v(n)2)u(n) \cdot v(n) = o(v(n)^2). Both claims follow from standard asymptotic arithmetic rules. Choice B incorrectly suggests multiplication doesn't preserve little-o relationships. Choice C is wrong because when one function dominates (little-o case), the sum is determined by the larger function. Choice D is unnecessarily restrictive since standard asymptotic analysis handles these operations.

Question 13

Consider the recurrence relation T(n)=4T(n/2)+n2lognT(n) = 4T(n/2) + n^2\log n with T(1)=1T(1) = 1. Using the Master Theorem framework, what can be concluded about the asymptotic growth of T(n)T(n)?

  1. T(n)=Θ(n2logn)T(n) = \Theta(n^2\log n) because f(n)=n2lognf(n) = n^2\log n and nlog24=n2n^{\log_2 4} = n^2, satisfying case 2
  2. T(n)=Θ(n2log2n)T(n) = \Theta(n^2\log^2 n) because the extra logn\log n factor requires the generalized case 2 analysis (correct answer)
  3. T(n)=Θ(n2)T(n) = \Theta(n^2) because the recursive term 4T(n/2)4T(n/2) dominates the additive term asymptotically
  4. The Master Theorem cannot be applied because f(n)=n2lognf(n) = n^2\log n doesn't satisfy the regularity condition required
Explanation: For the Master Theorem, we have a=4a = 4, b=2b = 2, so nlogba=nlog24=n2n^{\log_b a} = n^{\log_2 4} = n^2. We need to compare f(n)=n2lognf(n) = n^2\log n with n2n^2. Since f(n)=n2logn=Θ(n2logn)f(n) = n^2\log n = \Theta(n^2\log n) and n2lognn^2\log n is asymptotically larger than n2n^2 but not polynomially larger (the ratio is logn\log n), this falls under the generalized case 2 of the Master Theorem. Specifically, f(n)=Θ(n2log1n)f(n) = \Theta(n^2\log^1 n), so T(n)=Θ(n2log2n)T(n) = \Theta(n^2\log^2 n). Choice A is wrong because it ignores the extra logn\log n factor. Choice C is wrong because f(n)f(n) actually dominates n2n^2. Choice D is wrong because the regularity condition can be verified.

Question 14

An algorithm's space complexity is given by S(n)=n+k=1log2n2kS(n) = n + \sum_{k=1}^{\lfloor \log_2 n \rfloor} 2^k. What is the asymptotic space complexity of this algorithm?

  1. S(n)=Θ(n)S(n) = \Theta(n) because the linear term dominates the geometric series for large nn
  2. S(n)=Θ(nlogn)S(n) = \Theta(n \log n) because there are logn\log n terms each contributing O(n)O(n) to the sum
  3. S(n)=Θ(n+2logn)=Θ(2n)=Θ(n)S(n) = \Theta(n + 2^{\log n}) = \Theta(2n) = \Theta(n) since both terms have the same order (correct answer)
  4. S(n)=Θ(2logn)=Θ(n)S(n) = \Theta(2^{\log n}) = \Theta(n) because the geometric series dominates the linear term
Explanation: Let's evaluate the sum k=1log2n2k\sum_{k=1}^{\lfloor \log_2 n \rfloor} 2^k. This is a geometric series with first term 21=22^1 = 2 and ratio r=2r = 2. The sum equals k=1m2k=2(2m1)/(21)=2m+12\sum_{k=1}^{m} 2^k = 2(2^m - 1)/(2-1) = 2^{m+1} - 2 where m=log2nm = \lfloor \log_2 n \rfloor. Since log2nlog2n<log2n+1\lfloor \log_2 n \rfloor \leq \log_2 n < \lfloor \log_2 n \rfloor + 1, we have 2log2nn<2log2n+12^{\lfloor \log_2 n \rfloor} \leq n < 2^{\lfloor \log_2 n \rfloor + 1}. Therefore 2log2n+12n2^{\lfloor \log_2 n \rfloor + 1} \leq 2n, so the sum is Θ(n)\Theta(n). Combined with the nn term: S(n)=n+Θ(n)=Θ(n)S(n) = n + \Theta(n) = \Theta(n). Choice A has the right answer but wrong reasoning about which term dominates. Choice B incorrectly analyzes the sum. Choice D has correct reasoning about the geometric series but wrong conclusion about dominance.

Question 15

The function F(n)=n1.5+nlognF(n) = \lfloor n^{1.5} \rfloor + \lceil \sqrt{n} \log n \rceil represents the complexity of a hybrid algorithm. What is the most precise asymptotic characterization of F(n)F(n)?

  1. F(n)=Θ(n1.5)F(n) = \Theta(n^{1.5}) because the floor/ceiling functions don't affect the dominant term asymptotically (correct answer)
  2. F(n)=Θ(n1.5+nlogn)F(n) = \Theta(n^{1.5} + \sqrt{n} \log n) because both terms contribute to the asymptotic growth significantly
  3. F(n)=O(n1.5)F(n) = O(n^{1.5}) but the exact Θ\Theta bound cannot be determined due to the floor and ceiling operations
  4. F(n)=Θ(nlogn)F(n) = \Theta(\sqrt{n} \log n) because the ceiling operation can amplify the second term unpredictably
Explanation: For asymptotic analysis, we need to determine which term dominates. We have n1.5n^{1.5} versus nlogn=n0.5logn\sqrt{n} \log n = n^{0.5} \log n. Since limnn0.5lognn1.5=limnlognn=0\lim_{n \to \infty} \frac{n^{0.5} \log n}{n^{1.5}} = \lim_{n \to \infty} \frac{\log n}{n} = 0, the first term dominates. The floor and ceiling functions only change the value by at most 1, which is negligible compared to n1.5n^{1.5} for large nn. Therefore F(n)=n1.5+o(n1.5)=Θ(n1.5)F(n) = n^{1.5} + o(n^{1.5}) = \Theta(n^{1.5}). Choice B is wrong because the second term is dominated by the first. Choice C is wrong because Θ\Theta bounds can be determined. Choice D is completely incorrect about which term dominates.

Question 16

Consider the function h(n)=i=1ni2logih(n) = \sum_{i=1}^{n} i^2 \log i. Which of the following best characterizes the asymptotic growth of h(n)h(n)?

  1. h(n)=Θ(n3)h(n) = \Theta(n^3) because the sum is dominated by the largest term n2lognn^2 \log n
  2. h(n)=Θ(n2log2n)h(n) = \Theta(n^2 \log^2 n) because the average term is O(nlogn)O(n \log n) and there are nn terms
  3. h(n)=Θ(n4)h(n) = \Theta(n^4) because the sum of squares grows as n3n^3 and the logarithmic factor adds another order
  4. h(n)=Θ(n3logn)h(n) = \Theta(n^3 \log n) because integration approximation gives 1nx2logxdxn3logn3\int_1^n x^2 \log x \, dx \approx \frac{n^3 \log n}{3} (correct answer)
Explanation: When analyzing the asymptotic growth of sums involving products of polynomial and logarithmic terms, integration provides the most reliable approximation method. For large n, the sum i=1ni2logi\sum_{i=1}^{n} i^2 \log i behaves similarly to the integral 1nx2logxdx\int_1^n x^2 \log x \, dx. To evaluate this integral, use integration by parts with u=logxu = \log x and dv=x2dxdv = x^2 dx. This gives du=1xdxdu = \frac{1}{x}dx and v=x33v = \frac{x^3}{3}. The integral becomes: x2logxdx=x3logx3x331xdx=x3logx3x39\int x^2 \log x \, dx = \frac{x^3 \log x}{3} - \int \frac{x^3}{3} \cdot \frac{1}{x} dx = \frac{x^3 \log x}{3} - \frac{x^3}{9} Evaluating from 1 to n gives approximately n3logn3\frac{n^3 \log n}{3} for large n, confirming that h(n)=Θ(n3logn)h(n) = \Theta(n^3 \log n). Choice A incorrectly assumes the largest term dominates, but this only works when terms don't grow too quickly relative to their number. Here, we have n terms each roughly of size O(n2logn)O(n^2 \log n), requiring more careful analysis. Choice B miscalculates both the average term size and fails to account for how the sum of quadratic terms grows. Choice C incorrectly adds orders of magnitude. The i2=Θ(n3)\sum i^2 = \Theta(n^3) fact doesn't directly apply when logarithmic factors are involved within each term. Choice D correctly applies integration approximation, the standard technique for sums of smooth, monotonic functions. Study tip: For asymptotic analysis of sums i=1nf(i)\sum_{i=1}^n f(i) where f(x) is smooth and increasing, approximate with 1nf(x)dx\int_1^n f(x)dx rather than trying to find patterns in individual terms.

Question 17

Consider the functions f(n)=n2log2nf(n) = n^2 \log_2 n and g(n)=n2.1g(n) = n^{2.1}. For sufficiently large values of nn, which statement best describes the relationship between these growth rates?

  1. f(n)=O(g(n))f(n) = O(g(n)) but g(n)O(f(n))g(n) \neq O(f(n)), so g(n)g(n) grows asymptotically faster than f(n)f(n) (correct answer)
  2. g(n)=O(f(n))g(n) = O(f(n)) but f(n)O(g(n))f(n) \neq O(g(n)), so f(n)f(n) grows asymptotically faster than g(n)g(n)
  3. f(n)=Θ(g(n))f(n) = \Theta(g(n)), meaning both functions have the same asymptotic growth rate
  4. The relationship depends on the base of the logarithm, making comparison impossible without more information
Explanation: For any polynomial nkn^k where k>2k > 2, we have n2logn=o(nk)n^2 \log n = o(n^k). Since 2.1>22.1 > 2, we have n2log2n=o(n2.1)n^2 \log_2 n = o(n^{2.1}), which means f(n)=O(g(n))f(n) = O(g(n)) but g(n)O(f(n))g(n) \neq O(f(n)). The logarithmic factor grows much slower than any positive polynomial factor. Choice B reverses the relationship. Choice C is incorrect because the functions don't have the same growth rate. Choice D is wrong because logarithm base only affects constants, not asymptotic relationships.

Question 18

An algorithm's space complexity is given by S(n)=i=1nlogiiS(n) = \sum_{i=1}^{n} \frac{\log i}{i}. What is the asymptotic behavior of this space complexity?

  1. Θ(logn)\Theta(\log n) because the sum is dominated by the largest terms where ii is close to nn
  2. Θ(nlogn)\Theta(n\log n) because there are nn terms each roughly of size logn\log n
  3. Θ(log2n)\Theta(\log^2 n) because the integral 1nlogxxdx=(logn)22\int_1^n \frac{\log x}{x} dx = \frac{(\log n)^2}{2} (correct answer)
  4. Θ(n)\Theta(n) because the sum has nn terms and the average term size is constant
Explanation: When analyzing asymptotic behavior of sums, you need to determine whether discrete summation or integral approximation gives the most accurate result. For sums where terms vary significantly across the range, integral approximation often provides the key insight. To find the asymptotic behavior of S(n)=i=1nlogiiS(n) = \sum_{i=1}^{n} \frac{\log i}{i}, consider the integral approximation: 1nlogxxdx\int_1^n \frac{\log x}{x} dx. Using substitution with u=logxu = \log x, so du=1xdxdu = \frac{1}{x}dx, this integral becomes 0lognudu=u220logn=(logn)22\int_0^{\log n} u \, du = \frac{u^2}{2}\Big|_0^{\log n} = \frac{(\log n)^2}{2}. Since the function logxx\frac{\log x}{x} is positive and well-behaved over [1,n][1,n], the sum and integral have the same asymptotic growth, giving us Θ(log2n)\Theta(\log^2 n). Choice A incorrectly assumes the sum is dominated by large terms near nn. However, lognn\frac{\log n}{n} approaches 0 as nn \to \infty, so the largest individual terms actually occur in the middle range, not at the end. Choice B makes the error of treating all terms as roughly logn\log n in size. This ignores that early terms are much smaller (log11=0\frac{\log 1}{1} = 0, log220.35\frac{\log 2}{2} \approx 0.35) and later terms decrease due to the 1i\frac{1}{i} factor. Choice D assumes the average term size is constant, but logii\frac{\log i}{i} clearly depends on ii and isn't bounded by a constant. Study tip: When analyzing sums with varying terms, try integral approximation—it often reveals the true asymptotic behavior more clearly than attempting to estimate individual terms.

Question 19

Let f(n)=n2lognf(n) = \sqrt{n} \cdot 2^{\sqrt{\log n}} and g(n)=n0.6g(n) = n^{0.6}. Which statement correctly describes the asymptotic relationship between these functions?

  1. f(n)=O(g(n))f(n) = O(g(n)) because exponential functions with sublinear exponents grow slower than polynomial functions
  2. g(n)=O(f(n))g(n) = O(f(n)) because any exponential function eventually dominates any polynomial function
  3. f(n)=Θ(g(n))f(n) = \Theta(g(n)) because logn\sqrt{\log n} grows slowly enough to balance the exponential with the polynomial
  4. f(n)=O(g(n))f(n) = O(g(n)) because 2logn2^{\sqrt{\log n}} is polylogarithmic, making the product subpolynomial (correct answer)
Explanation: The key insight is that 2logn=(2logn)1/logn=n1/logn2^{\sqrt{\log n}} = (2^{\log n})^{1/\sqrt{\log n}} = n^{1/\sqrt{\log n}}. Since 1/logn01/\sqrt{\log n} \to 0 as nn \to \infty, this factor grows like a polylogarithmic function. Therefore f(n)=n(logn)O(1)=o(n0.6)f(n) = \sqrt{n} \cdot (\log n)^{O(1)} = o(n^{0.6}). Choice A gives the right answer but wrong reasoning. Choice B incorrectly applies the general rule about exponentials. Choice C is wrong because the functions aren't asymptotically equivalent.