Question: Consider the following erroneous binary-search procedure: Procedure new-binary- search (key: some-element; table: some-elementTable; found: Boolean, pos: integer) Begin bottom := tablefirst; top:=tablelast; middle := (bottom+top)/
Consider the following erroneous binary-search procedure:
Procedure new-binary- search (key: some-element; table: some-elementTable; found: Boolean, pos: integer)
Begin
bottom := tablefirst; top:=tablelast;
middle := (bottom+top)/ 2;
found :=false while bottom <= top and not found loop if key = table(middle) then found:= true;
else if
key < table(middle) then top:= middle -1; else bottom := middle + 1;
end if;
middle := (bottom + top) /2
end loop;
end new-binary- serach
1. Draw flow graph (or program graph) for the following procedure
2. Determine the cyclomatic complexity of the resultant flow graph
3. Identify a set of independent paths (or a basis set) that would detect the error
4. Is it possible that even successfully testing of the above procedure with arbitrarily large tables does not guarantee correctness (if it is yes, briefly explain).
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
