Question: 3. (25 points) Find running time functions for the algorithms below and write their classification using Big-O asymptotic notation in terms of n. A running

3. (25 points) Find running time functions for the algorithms below and write their classification using Big-O asymptotic notation in terms of n. A running time function should provide a formula on the number of arithmetic operations and assignments performed on the variables s, t, or c (the return value). Note that array indices start from 0. Algorithm Ex1(A): Input: An array A storing n> 1 integers. Output: The sum of the elements in A. S+ AO for i=1 to n-1 do S+ 8 + A[i] end for returns Algorithm Ex2 (A): Input: An array A storing n>1 integers. Output: The sum of the elements at even positions in A. S+ A0 for it 2 to n-1 by increments of 2 do S+ 8 + A[i] end for returns
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
