Question: Question below, I'm mainly interested in how to answer this, more than just getting the answer. I would be grateful if you could explain step

Question below, I'm mainly interested in how to answer this, more than just getting the answer. I would be grateful if you could explain step by step Question below, I'm mainly interested in how to answer this, more than

3. [20 pts.] A friend majoring in finance wants to implement an algorithm for computing the prefix variance of a sequence dataset of n real-valued numbers , 01,..., Q. 1, defined as the sequence of n real-valued numbers 7,27,..., such that t = 0, 1, ..., 6-1, -(--(-)) Our friend, having found the following two algorithms, PREFIXVARIANCEl and PREFIX VARIANCE2, that perform the task correctly but not knowing which one to implement, is asking for your recommendation. Both algorithms take as input an n-element array A such that each element A[j= a; for all i = 0,1,..., n 1, and output an n-element array B such that each element B[i] = 6; for all i = 0,1,..., n - 1 with the corresponding prefix variance evaluation of the sequence in A. Algorithm 1 PREFIXVARIANCE(A) 1: B = new array of n numbers 2: for tO to n-1 do 3: VO 1: for 10 to 1 do 5: 20 for j = 0 tot do 7: z++A 8: 22/(t+1) d Ail - 2 10: 00+did 11: Bt] - v/(t+1) 12: return B 6: Algorithm 2 PREFIX VARIANCH2(A) 1: B new array of n numbers 2: for t=0 to n-1 do 3: for i40 to t do 5: 2+ 3+ A[] 6: 2 + 2/(1+1) 7: 00 for i = 0 to t do d

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!