B3. Consider an array a] = { "Abdullah", "Butaina", "George", "Inam", "Jim", "kawther", "kavin", "Raba", "Robin", "Roza"}. The name "George" (target) to be searched using the binary search algorithm...


B3. Consider an array a] = {

Extracted text: B3. Consider an array a] = { "Abdullah", "Butaina", "George", "Inam", "Jim", "kawther", "kavin", "Raba", "Robin", "Roza"}. The name "George" (target) to be searched using the binary search algorithm given below. Trace the variables low, high, and mid to complete the task. Public int binarySearch(String[] a, String target) { low=0; While (low <= high)="" {="" high="a.length-1" low="" high="" mid="" int="" mid="(low+high)/2;" int="" com="target.compareTo(a[mid]);" if="" (com="=" 0)="" return="" mid;="" else="" if="" (com="">< 0)="" high="mid-1;" else="" low="mid+l;" }="" return="" -1;="">

Jun 09, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here