CS C++ Quiz 9 (old 6) True or false: An O(N) algorithm will outperform an O(N2) algorithm for all values of N. Consider searching for a given value in an array. Which of the following must be true to use binary search? I. The values in the array must be integers. II. The values in the array must be sorted. III. The array must not contain any duplicate values. (a) I only (b) II only (c) I and II only (d) II and III only (e) I, II, and III Consider searching for a given value in a sorted array. Under which of the following circumstances will linear search perform fewer comparisons than binary search? (a) The value is not in the array. (b) The value is in the first position of the array. (c) The value is in the last position of the array. (d) The value is in the middle position of the array. (e) Sequential search will never perform fewer comparisons than binary search. How many elements will linear search have to examine to find the number 36 in this array? 1 6 16 18 26 36 37 39 45 (a) 2 (b) 3 (c) 4 (d) 6 How many elements will quadratic search have to examine to find the number 36 in this array? 1 6 16 18 26 36 37 39 45 (a) 2 (b) 3 (c) 4 (d) 6 How many elements will binary search have to examine to find the number 36 in this array? 1 6 16 18 26 36 37 39 45 (a) 2 (b) 3 (c) 4 (d) 6 In terms of N, how many basic steps are performed when this code fragment is run? for (j = 0; j < N; j++) { sum = 0; for (i = 0; i < 5; i++) { sum += i; } running += sum; } cout << "answer = " << running / N << endl;