I have an assignment dealing with algorithms and Big O notation. I am a little confusded about this notation stuff. Here are a few of the questions on the assignment:

What is the O-notation for the following code?

```
cin >> N;
for (int count = 1; count <= N; count++) {
for(int count2 = 1; count2 <= N; count2++) {
cout << count1 + count2;
}
}
```

```
a. O(1) c. O(log N)
b O(N) d. O(N2)
```

Since there are two loops I thought that you would do this:

N*N = N^2 which would mean that the answer would be d, but after researching some on this subject I found this talking about Big O notation.

If the outer loop is based on N, and the inner loop is based on the outer loop counter, then it is based on the same thing:

That would mean the answer would be b. This is what I am confused about. Could someone elaborate on this.

4.2 What is the O-notation for the following code?

```
cin >> N;
for (int count = 1; count <= N; count++) {
for(int count2 = 1; count2 <= count; count2++) {
cout << count1 + count2;
}
}
```

```
a. O(log N) c. O(N2)
b. O(N) d. O(N3)
```

Same thing with this problem. I think the answer is b or c. But I am not sure if someone can explain this a little better I would really appreciate it.

Thanks.