Time complexity

Hello there!

Me and my friends are trying to understand an assignment about time complexity in c++. Can someone help us to understand which one of us is thinking correctly?

The assignment is this:

int doing(int n)
{
int k = 0;
int result = 0;
while (k<n*n)
{
for (int i = 10; i<20; i++)
result +=n;
k++;
}
return result;
}

We have to decide O(n) and T(n) for this function.
I have come up with the results:

49n^2+4

And my friend:
64n^2+4


Which one of us is right or are we both wrong?
It is of course n2*10:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
 #include <iostream>             // provides:  cout, cin
#include <iomanip>              // provides:  setw
#include <limits>
// setting up the environment
  using namespace std;

int count = 0; // This counts the number of iterations

int doing(int n)
{
int k = 0;
int result = 0;
while (k<n*n)
{
for (int i = 10; i<20; i++)
{
    count++;
result +=n;
}
k++;
}
return result;
} 

int main()
{
    doing(100);
    cout << count;
    

  return 0;
}
100000 = 1002*10
Topic archived. No new replies allowed.