complexity of code

what's the time complexity of following code and why?

1
2
3
4
5
6
7
for (i = 2; i*i <= n; i++) {
  if (a[i]) {
    for (j = i*i; j <= n; j+=i) {
      a[j] = 0;
    }
  }  
}


one more question, is structure a primitive data type, if so, why?
The algorithm's a trick question.
is structure a primitive data type, if so, why?

Not in my opinion. int, char, long, float, double... are primitive data types. struct and class are used to make custom/complex data types.
Topic archived. No new replies allowed.