Skip to main content

GATE CSE 1993Algorithms › Growth of Functions & Complexity AnalysisVerified

GATE CSE 1993 PYQ: ∑ 1 ≤ k ≤ n O ( n ) \displaystyle \sum_{1\leq k\leq n} O(n) 1 ≤ k ≤ n ∑ ​ O ( n ) , where O ( n ) O(n) O ( n…

∑1≤k≤nO(n)\displaystyle \sum_{1\leq k\leq n} O(n), where O(n)O(n) stands for order nn is:

  1. A
    O(n)O(n)
  2. B
    O(n2)O(n^2)
    Correct answer
  3. C
    O(n3)O(n^3)
    Correct answer
  4. D
    O(3n2)O(3n^2)
    Correct answer
  5. E
    O(1.5n2)O(1.5n^2)
    Correct answer

Answer

(B, C, D, E) O ( n 2 ) O(n^2) O ( n 2 ); O ( n 3 ) O(n^3) O ( n 3 ); O ( 3 n 2 ) O(3n^2) O ( 3 n 2 ); O ( 1.5 n 2 ) O(1.5n^2) O ( 1.5 n 2 )

Approach

The sum runs over n terms, each of order O(n). Summing n copies of O(n) yields $O(n^2)$. In asymptotic notation, constant factors are absorbed, so $O(3n^2)$ and $O(1.5n^2)$ are the same as $O(n^2)$. Also, any function that is $O(n^2)$ is automatically $O(n^3)$ because $O(n^2)$ is a subset of $O(n^3)$. Hence all options except O(n) are mathematically correct.

The sum is $O(n^2)$. Options B, C, D, and E are all correct because $O(n^2)$ is the tight bound, constant multiples are absorbed, and $O(n^2)$ is a subset of $O(n^3)$. Option A is incorrect.

Reviewed by GateIQ Editorial Team: IIT & IISc Alumni.