Question: int sum = 0 ; for ( int i = N; i > 0 ; i - - ) { if ( i % 2

int sum =0;
for(int i = N; i >0; i--){
if(i %2==0){
sum +=1;
}
}
(Careful, the if statement should be part of the BigO and will be different from sum+=1. For sum+=1 consider when the if statement will be true and how many times that will occur for a given positive integer N.)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!