Determine the order of the loop body, then multiply by the number of executions.
Example:
for (int count = 0; count < n; count++)
// some sequence of O(1) steps
Consider the following loop:
count = 1;
while (count < n) {
count *= 2;
// some sequence of O(1) steps
}
For nested loops, multiply the complexity of the outer loop by the complexity of the inner loop.
Example:
for (int count = 0; count < n; count++)
for (int count2 = 0; count2 < n; count2++) {
// some sequence of O(1) steps
}