Question: Consider the following program segment: /* sort takes an integer array and sorts it in ascending order*/ 1. void sort (int a [ ], int

Consider the following program segment:

/* sort takes an integer array and sorts it in ascending order*/

1. void sort (int a [ ], int n) {

2. int i, j;

3. for(i=0;i

4. for(i=i+1;j

5. if(a[i]>a[j])

6. {

7. temp=a[i];

8. a[i]=a[j];

9. a[j]=temp;

10. }

11. }

(a) Draw the program graph for this program segment.

(b) Determine the cyclomatic complexity for this program (show the intermediate steps of your computation).

(c) How is the cyclomatic complexity metric useful?

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 Software Testing And Quality Assurance Questions!