Question: For the following linear search algorithm given below, do a ) Draw the control flow graph and calculate Cyclomatic Complexity b ) Identify all the

For the following linear search algorithm given below, do
a) Draw the control flow graph and calculate Cyclomatic Complexity
b) Identify all the Independent paths or basis set of all the execution paths.
algo linearSearch (arr, size, elem)
{
int i=0;
int found =0;
while ((i < size) or (!found))
{
if (elem == arr[i]) found =1;
i++;
}
if (found == true)
printf(Element found at %d, i);
else printf(Element not found);
return found;
}
STRICT NOTE : ANSWERS PASTED WITHOUT EFFORT FROM CHATGPT/CLAUDE/GEMINI WILL BE DOWNVOTED

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 Programming Questions!