how many times is the println statement executed
Answers
Answered by
1
I have been looking at this example for a while now and i'm stuck, my question is how many times the statement:
System.out.println(y);
would be executed in the following code:
for(int x=0;x<N;x++){
for(int y=x;y<N;y++){
System.out.println(y);
}
}
I was thinking it would surely be printed N+N-1+N-2(...) times right? We are studying Big-O complexity but i'm struggling with this at the moment.
hope this will help you♥✌
Similar questions
Computer Science,
5 months ago
English,
5 months ago
Math,
10 months ago
Political Science,
10 months ago
English,
1 year ago
Math,
1 year ago