Find the efficiency class I have to find the efficiency class of this algorithm 

b = 3
a = 4
for i = 4 to n^2
    if (i mod 2 == 0)
        a = a+2 
    else
        b = b*3
end for


I solve it like this, first I find the time for executed a then b and the total is the addition, is it right? I'm not sure if I have to do it like this or not, I let $n=\frac{n^2}{2}$ because of the $\bmod 2$ is it right?

$t_a(n)=\sum_{j=1}^{n^{2}/2}1=\dfrac{n^{2}}{2}$

$t_b(n)=\sum_{j=4}^{n^{2}}1-\dfrac{n^{2}}{2}=n^{2}-\dfrac{n^{2}}{3}-3$

$t(n)=\dfrac{n^{2}}{2}+n^{2}-\dfrac{n^{2}}{3}-3=\Theta (n^{2})$ by the polynomial theorem.
The final result is true. But, you have a fault in your computation, as in each iteration you have at least a comparison. Hence, instead of $\frac{n^2}{2}$, we will have $n^2 - 3$. Anyhow, the final result is the time complexity is $\Theta(n^2)$.