in Programming in C
234 views
1 vote
1 vote
find the total number of comparisons-

for(j=1;j<=n-1;j++)

{

for(k=j+1;k<=n+1;j++)

{

if(A[j]<A[k])

A[j]=A[j]+2;

}

}

so my question is do i need to consider for loop condition comparison too or not because in answer they did not consider the comparison of  “for loop”
in Programming in C
234 views

2 Comments

i think they should be considered!

as total comparisons are asked so we will be counting overall comparisons

even i got 7056 for this!

i guess their answer is wrong!!
0
0
ohk thanks
0
0

Please log in or register to answer this question.