Question

What is the Cyclomatic Complexity for the following pseudo-code fragment? i=1; n=10; while (i<n) do             ...

What is the Cyclomatic Complexity for the following pseudo-code fragment?

i=1;

n=10;

while (i<n) do    

         j=i+1;    

while (j<n) do        

if A[i]<A[j] then            

swap(A[i], A[j]);        

end if    

    end while;    

    i=i+1;

end while;

CC = E – N + 2P

E = number of edges (transfers in control)

N = number of nodes

P = number of disconnected parts of the flow graph (e.g. a calling program and a subroutine)

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Flow graph for this program will be


number of nodes =N= 7

number of edges=E=9

number of disconnected part of flow graph=P=1

Cyclomatic Complexity= E-N+2P

= 9-7+2(1)

= 4

NODE 1,2,3 ARE CONDITION NODES

Add a comment
Know the answer?
Add Answer to:
What is the Cyclomatic Complexity for the following pseudo-code fragment? i=1; n=10; while (i<n) do             ...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT