485 views
0 votes
0 votes
What is cyclomatic complexity of below program below:

i=0; n=4;

while(i<n-1)

{j=i+1;

   while(j<n)

{if(A[i]< A[j]) swap (A[i],A[j]);}

i=i+1;

}

A)3      B)4    C)5    D)6

1 Answer

Related questions

0 votes
0 votes
0 answers
1
Naveen Kumar 3 asked Nov 3, 2018
967 views
Suppose, we have an array of n elements. find the time complexity to search two elements x, y such that:-a) x+y < 100b) x+y 1000Also, state the algorithm/approach for th...
0 votes
0 votes
1 answer
2
Simran Singh asked Aug 11, 2017
231 views
for(i=0;i<=n;i++) for(j=i;j<=n;j++) for(k=j;k<=n;k++) S++;
4 votes
4 votes
2 answers
3
sumit goyal 1 asked Aug 9, 2017
3,601 views
int sum(int A[], int n) { int sum = 0, i; for(i = 0; i < n; i++) sum = sum + A[i]; return sum; }
3 votes
3 votes
1 answer
4
sumit_kumar asked Jun 25, 2017
3,146 views
what is time comlexity procedure for following recursive equation by substitution method:T(n)= T(n-1)+T(n-2) , if n>=2 =1 , if n=1; =0 , if n=0.