Totally confused on time complexities.
I am studying Computer Science.
Currently we are doing time complexities of loops..
I am confused on how to count the repetitions of the loop..
For ( i=1; i<=n; i++)
For (int j=1; j<=2; j x= 2)
i j reps
1 1-2 2
2 1-2^2 3
3 1-2^2 3
n 1-2^n ?
Do you count the inner loop? Do you add up the previous repetitions?
Im just totally confused.
Any break down would be appreciated. Thanks guys
Re: Totally confused on time complexities.
My browser shows the third part of the inner "for" as "j x= 2". If this is so, then it is an error because x is not declared and because j cannot be applied to x since j is not a function.