Consider the following: 2 10 17 45 49 55 68 85 92 98 110 Using the binary search
ID: 3609326 • Letter: C
Question
Consider the following:2 10 17 45 49 55 68 85 92 98 110
Using the binary search, how many comparisons are required todetermine wheather the following items are in the list? Show thevalues of FIRST, LAST, MIDDLE, and the number of comparisons afterthe iteration of the loop. a. 15 b. 49 c. 98 d. 99
2 10 17 45 49 55 68 85 92 98 110
Using the binary search, how many comparisons are required todetermine wheather the following items are in the list? Show thevalues of FIRST, LAST, MIDDLE, and the number of comparisons afterthe iteration of the loop. a. 15 b. 49 c. 98 d. 99
Explanation / Answer
please rate - thanks the 2 compares are counted as 1 because if doing by hand it wouldbe 1 comparison import java.util.*; public class binarysearch { public static void main( String [] args ) { Scanner in= newScanner(System.in); int size = 11,num; int [ ] a = new int[]{2,10,17,45,49,55,68,85,92,98,110}; for( int i = 0; iRelated Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.