Question: Modify the binary search algorithm to take the upper of the two middle array elements in case the input array has even length. In other

Modify the binary search algorithm to take the upper of the two middle array elements in case the input array has even length. In other words, in the binary search algorithm, replace mid : = bot + top with mid := [ bot + top N N Trace the action of the modified binary search algorithm on the variables index, bot, top, mid, and the given values of x for the input array a[1] = Ann, a[2] = Dawn, a[3] = Erik, a[4] = Gail, a[5] = Juan, a[6] = Matt, a[7] = Max, a[8] = Rita, a[9] = Tsuji, a[10] = Yuen, where alphabetical ordering is used to compare elements of the array. (a) x = Erik iteration N O index O bot top mid X Erik (b) x = Sara N iteration index O bot top mid X Sara
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
