Section 5. Searching and Sorting (35 pts) For Q15-Q16, we are performing a binary search on a sorted array called number
Posted: Tue Jul 05, 2022 10:25 am
Section 5. Searching and Sorting (35 pts) For Q15-Q16, we are performing a binary search on a sorted array called numbers initialized as follows: int[] numbers = {-5, -1, 3, 5, 7, 10, 18, 29, 37, 42, 58, 63, 94}; // search for the value 33 int index = binary Search(numbers, 33); Write the indexes of the elements that would be examined by the binary search (the mid values in our algorithm's code) and write the value that would be returned from the search. Assume that we are using the binary search algorithm shown in lecture. Q15. Indexes examined (10 pts):_ Q16. Value Returned by binary search (5 pts): For Q17-Q19, you are given the following array of 10 numbers (8, 10, 5, 9, 6, 2, 4, 1, 7, 3). For all sorting, sort in ascending order. Do not draw multiple arrays. If needed, use a separate scratch paper for your thought process. Q17. Extra Credit. Using the quick sort, what is the resulting array after the first iteration given the above array? Assume the same code and algorithm we used in class, which is provided at the end of this exam. Let CUTOFF be 3. 10 pts EC. index 0 index 0 1 index 0 2 1 2 3 2 Q18. Using the selection sort, what is the resulting array after the 3 iteration of the outer loop? Assume the same code and algorithm we used in class. 10 pts. 1 4 5 3 4 3 5 4 6 5 6 7 Q19. Using the heap sort, what is the resulting array after the "deletion" is performed twice? Assume the same code and algorithm we used in class. 10 pts. 6 7 8 7 8 9 8 9 9