Answered step by step
Verified Expert Solution
Question
1 Approved Answer
[Verification and Validation] NOTE: We assume that swap(a, i, j) is a pre-defined function which swaps the values in the i th block and the
[Verification and Validation]
NOTE: We assume that swap(a, i, j) is a pre-defined function which swaps the values in the ith block and the jth block in array a.
1) Draw a control flow graph for the program above.
2) From the control flow graph in Question 1, answer the following questions: 2.1) What are the prime paths in the graph? 2.2) Is there a set of test inputs that satisfies prime path coverage on the graph? If so, find a smallest set that satisfies prime path coverage.
1 ublic void sort(int[] arr) l 2: boolean flag = true; int j = 0; 4: 5: while (flag) t flag = false; 7: 8 for (int i = 0; i arr. length- j, i++) { if (arr [i] arr [i + 1]) { swap (arr, i, i+l) flag = true; 10: 12: 13: 14: 15Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started