The GATE Grind

GATE 2012 CS (CS1) – Question 28

Algorithms · Asymptotic Analysis and Time/Space Complexity · 1 mark · Multiple choice

W(n) and A(n) are worst-case and average running times on inputs of size n. Which always holds?

  1. $A(n)=\Omega(W(n))$
  2. $A(n)=\Theta(W(n))$
  3. $A(n)=O(W(n))$
  4. $A(n)=o(W(n))$

Practise this question in The GATE Grind →

Show answer and explanation

Correct answer: (C) $A(n)=O(W(n))$

Explanation

An average over inputs cannot exceed the maximum running time on those inputs, so A(n)≤W(n) and A(n)=O(W(n)), C. Equality in Θ need not hold, while little-o fails when average and worst case have the same order.

More Asymptotic Analysis and Time/Space Complexity questions

All Asymptotic Analysis and Time/Space Complexity questions →