# Help with Big-O notation complexity [duplicate]

How do I find the O - notation complexity for the following?

`````` int sum = 0;
for (int i = 1; i <= n*2; i++ )
sum++;
``````

I read the guide on Big - O and other posts on Big -O complexity, but I'm still lost.

## marked as duplicate by Erik Eidt, Arseni Mourzenko, gnat, Doc Brown, Bart van Ingen SchenauNov 22 '16 at 11:12

• FWIW, start by looking up for an explicit formula for the number of iterations of the above loop. Google is your friend. – Doc Brown Nov 22 '16 at 7:28

• No matter how large `n` is, multiplying it by two will always have a large effect. There is a different reason for dropping the constant coefficient. If we didn't, we would have to count the individual operations: in each iteration you increment `i`, increment `sum`, calculate `n*2` and perform a comparison - 4 operations, so it's O(8n). But does each of these operation has the same cost? And maybe the machine is slow so each operation costs twice as much? To avoid dwelling in these specifics, it was decided that we should ignore the constant coefficient. – Idan Arye Nov 22 '16 at 2:11