has complexity [TEX]\Theta(n)[/TEX]. It is true that it has complexity [TEX]O(n)[/TEX], but also that it has complexity [TEX]\Omega(n)[/TEX], and therefore by definition, it has complexity [TEX]\Theta(n)[/TEX].

As for the program containing the sequence of for loops

for(int i=0.i<n;i++) {...}
for(int i=0.i<n;i++) {...}

The running time complexity is the same as in the case for the single for loop. The reason for this can be found in the mathematical definition of these complexity classes.

In other words, the running time complexity for the 2 sequential for loops is [TEX]\Theta(2n) = \Theta(n)[/TEX].