Question: C++ Program C++ Program Instruction: Answer each line according to the answer per line Consider the following function: gint binarySearch(int myArray[], int length, int element)

C++ Program  C++ Program C++ Program Instruction: Answer each line according to the
answer per line Consider the following function: gint binarySearch(int myArray[], int length,
int element) { int first = 0; int last = length -
1; int mid; bool found = false; EGASHAR while (first element) last
C++ Program Instruction: Answer each line according to the answer per line

Consider the following function: gint binarySearch(int myArray[], int length, int element) { int first = 0; int last = length - 1; int mid; bool found = false; EGASHAR while (first element) last = mid - 1; else first = midit; U-2345_1&cont bool found = false; while (first element) last = mid - 1; else first = mid + 1; if (found) return mid; else return -1; The inputs for the functions are: myArray[12] = {0,2,3,6,8,9,11,13,15,18,20,22 }; element = 8; Assume that you do not have a C++ compiler and you need to know if the function works. Fill out the next table every value change in each comparison or variable. | 0 [1] [2] myArray 0 | 2 | 3 [3] 6 [4 8 [5] 9 [6] 11 [7] 13 [8] 15 [9] [10] [11] 18 20 22 Comparisons and Variables first element [10] element [11] length [12] first [13] [15] last [16] mid [20] [21] [18] [22] [19] [23] | myArray mid [24] [25] found [26] [27] [29] [31] [28] [33] return value [32] [30] [35] [34] Specified Answer for: 1 false

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