Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Consider the following code 1 int binsearch ( int X , int V [ ] , int n ) 2 { 3 int low ,
Consider the following code
int binsearch int X int V int n
int low high mid i ;
low ;
high n ;
i ;
while i high
if V i V i
return ;
i ;
while low high
mid low high ;
if X V mid
high mid ;
else
if X V mid
low mid ;
else
return mid ;
return ;
This code takes as input a sorted array V of size n and an integer X if X exists in the array it will
return the index of X else it will return
Draw a data flow graph for the above binsearch function.
Assuming that the input array V has at least one element in it find an infeasible path in the
data flow graph for the binsearch function.
Find a set of complete paths satisfying the alldefs selection criterion with respect to variable
mid.
Find a set of complete paths satisfying the alldefs selection criterion with respect to variable
high.
Find a set of complete paths satisfying the alldefs selection criterion with respect to variable
low.
Step 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