Question: QUESTION 3 Consider plist -11.23,4 5, 6,7,8, 9, 10 ) We call recursiveBinarySearch0 to search the list for pKey - 4. During the search, the
QUESTION 3 Consider plist -11.23,4 5, 6,7,8, 9, 10 ) We call recursiveBinarySearch0 to search the list for pKey - 4. During the search, the first time that pkey is greater than the element at midle we will make a recursive call passing middle+ 1 and pHigh as the indices for the range of plist to be searched in the recursive call. What will be the values of middie + 1 and pHigh? passing middle + 1 and pHigh as the indices middle + 1 will be 5 and pHigh will be 3 middle + 1 will be 3 and pHigh will be 3 middle + 1 will be 4 and pHigh will be 9 middle + 1 will be 2 and pHigh will be 3 QUESTION 4 Consider list = (4, 2, 7, 3, 5, 13, 11, 8, 6, 2). Suppose we modify the quick sort algorithm so rather than choosing the first element at fromindex as pivot in the partition) method, we choose the last element element at tolndex as pivot. This requires a change to the quick Sort) method: when we make the original call to sort list, we still pass the indices of the first and last elements of list as the arguments to quickSortO-in this example, the call would be quickSort(list, o, 9) but on the subsequent recursive calls, we must pass rromindex and partitionder-1 as arguments to quickSorto-rather than passing fromindex and partitionindex as we would when choosing the first element as pivot we make those changes and then make the original call quicksort(list, , 9) to sort /sr. Since fromIndex is less than tolndex we will call partition(ist, o, 9). After we return from partition()-which returns partitionindex-we recursively call quicksort) twice. The question is: during the first recursive call, what what will be the values of the fromindex and Save All Answ
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
