The Gateway to Computer Science Excellence

+34 votes

Best answer

This is $N$ added itself $N$ times. So it is $N^2$^{ }. Even if you consider as sum of $O(1) + O(2) + .. O(n-1) + O(N)$. it will add up to $N^2$^{ }

So answer is

A) $O(N)$ this is false.

B,C,D,E ) All of this are true. We have $N^2$^{ }here, so all options apart from A are correct.

In fact B = D = E this three options are same. and $N^3$ is always upper bound of $N^{2}$. So $O(N^3)$ is also true.

--------------------------------------------------------------------------------------------------------------------------------------------------------------------------

PS: $∑ (K=1$ to $n)$ $O(K)$ is never equal to $n$ functions. It is always equal to one single function.

It can be written as $c.1+c.2+c.3$ and so on which results in $O(N^2)$ (source Cormen)

- All categories
- General Aptitude 1.9k
- Engineering Mathematics 7.5k
- Digital Logic 2.9k
- Programming and DS 4.9k
- Algorithms 4.3k
- Theory of Computation 6.2k
- Compiler Design 2.1k
- Databases 4.1k
- CO and Architecture 3.4k
- Computer Networks 4.1k
- Non GATE 1.5k
- Others 1.5k
- Admissions 595
- Exam Queries 576
- Tier 1 Placement Questions 23
- Job Queries 72
- Projects 17

50,645 questions

56,558 answers

195,717 comments

101,586 users