Consider the following program that uses binary search to check whether the input array contains a specific input value. (4*5=20 points)
public class BinarySearch {
public boolean contains(int[] a, int b) {
s1 if (a.length == 0) { //b1(true), b2(false) s2
return false;
}
s3 int low = 0;
s4 int high = a.length - 1;
s5 s6 |
|
while (low <= high) { //b3(true), b4(false) int middle = (low + high) / 2; |
s7 |
|
if (b > a[middle]) { //b5(true), b6(false) |
s8 |
|
low = middle + 1; |
s9 |
|
} else if (b < a[middle]) { //b7(true), b8(false) |
s10 |
|
high = middle - 1; |
s11 |
|
} else { |
s12 |
|
return true; |
|
|
} |
|
|
} |
s13 |
|
return false; |
|
} |
|
} |
|
|
iii. t3: a={1,2,3}, b=3
Statement coerage matrix
Branch coverage matrix
CS 340 Milestone One Guidelines and Rubric Overview: For this assignment, you will implement the fundamental operations of create, read, update,
Retail Transaction Programming Project Project Requirements: Develop a program to emulate a purchase transaction at a retail store. This
7COM1028 Secure Systems Programming Referral Coursework: Secure
Create a GUI program that:Accepts the following from a user:Item NameItem QuantityItem PriceAllows the user to create a file to store the sales receip
CS 340 Final Project Guidelines and Rubric Overview The final project will encompass developing a web service using a software stack and impleme