class NestedLoop {
public static void main(String[] args) {
int n = 10; // O(time complexity of the called function)
int sum = 0; //O(?)
double pie = 3.14; //O(?)
int var = 1; //O(?)
while(var < n) {
System.out.println("Pie: " + pie); //O(?)
for (int j = 0; j < var; j++) {
sum++; //O(?)
}
var *= 2; //O(?)
} //end of while loop
System.out.println("Sum: " + sum); //O(?)
} //end of main
} //end of class
Why is j<var;
executed 2n times?