CS205

Complexity Code Tracing

Count operations and trace through code to understand complexity.

Question 1 of 6Score: 0 pts
Count Loop Iterations

How many times does the print statement execute when n = 5?

void count(int n) {  // n = 5
    for (int i = 0; i < n; i++) {
        System.out.println(i);
    }
}