Qu Fr. LLLLL ou 1 - O 02 O GLS Consider the problem of finding the mode of an array, i.e., the value that appears the most times. The two algorithms model and mode2 are presented below. The input for both algorithms is the array A[0..n-1) of n numbers; the output is the value of the mode and the number of times that value is repeated. ALGORITHM model (A[O..n-1]) modeValue + A[0] modeRepeated + 1 for it to n-1 current + A[i] currentRepeated 0 for jei to n-1 if A[i]==A[j] currentRepeated + currentRepeated +1 if currentRepeated > modeRepeated modeValue + current modeRepeated + currentRepeated output modeValue, modeRepeated ALGORITHM mode 2 (A[0..n-1]) Sort array A in ascending order using quick-sort modeValue + A[0] modeRepeated + 1 current + A[0] currentRepeated + 1 it1 while i
modeRepeated modeValue + current modeRepeated currentRepeated current + A[i] currentRepeated + 1 it i+1 output modeValue, modeRepeated Q1.1 1 Point For algorithm mode1, state modeValue found for an instance with A=(6,8,9,9,8,3,1,8,3,3,3,8). Q1.2 1 Point For algorithm mode1, the formula for the number of comparisons A[i]==A[j] is On - 1 On + 1 On? on(n 1) o 3n(n+1) On? none of the above Q1.3 1 Point For algorithm mode2, state modeValue found for an instance with A=(6,2,9,9,2,8,1,2,8,8,8,2). Q1.3 1 Point For algorithm mode2, state modeValue found for an instance with A=(6,2,9,9,2,8,1,2,8,8,8,2). Q1.4 1 Point For algorithm mode2, the formula for the number of comparisons A[i]==current is On-1 On +1 On2 on(n 1) on(n + 1) On3 O none of the above Q1.5 1 Point Are the big-O complexity classes for model and mode2 the same? Yes O No Q1.6 1 Point State which algorithm, model or mode2, is expected to run faster on a randomly generated array A: model is expected to run faster mode2 is expected to run faster actual running times of both algorithms will be about the same Q1.7 1 Point State which algorithm, model or mode2, is expected to run faster on array A consisting of equal elements: model is expected to run faster mode2 is expected to run faster actual running times of both algorithms will be about the same<>