- n , n . for, while - , ( -!).
, O , , , ( , , , , ).
.
, .
for while - , .
, .
:
1. Input n
2. Do OperationX n times
Big O . . , :
1. Input n
2. Input m
3. Repeat m OperationX n times.
Big O , O (n), - O (m * n) ( OperationX ).
, , .
for(int i = 0; i < n; i++) {
operationX;
}
i = j = 0;
while(i < n) {
j = 0;
while(j < m) {
operationX;
j++;
}
i++;
}
. O , .
A[n] = some array of length n;
for(x = 0;x != A[i];i++) {
}
for (O(n)).