Answered step by step
Verified Expert Solution
Question
1 Approved Answer
A friend majoring in finance wants to implement an algorithm for computing the prefix variance of a sequence dataset of n real - valued numbers
A friend majoring in finance wants to implement an algorithm for computing the
prefix variance of a sequence dataset of realvalued numbers dots, defined as the
sequence of realvalued numbers widehatwidehatdots,widehat such that dots,
widehat
Our friend, having found the following two algorithms, PREFIXVARIANCE and PREFIXVARIANCE
that perform the task correctly but not knowing which one to implement, is asking for your
recommendation. Both algorithms take as input an element array A such that each element
for all dots, and output an element array such that each element
widehat for all dots, with the corresponding prefix variance evaluation of the
sequence in
Algorithm PREFIXVARIANCE
Blarr new array of numbers
for tlarr to do
vlarr
for ilarr to do
zlarr
for jlarr to do
zlarrz
zlarr
dlarrA
vlarrv
return
Algorithm PREFIXVARIANCE
Blarr new array of numbers
for tlarr to do
zlarr
for ilarr to do
zlarrz
zlarr
vlarr
for ilarr to do
dlarrA
vlarrv
return
Give time and space characterization using bigoh for prefixvariance
Give time and space characterization using big oh for prefixvariance
which one do you reccomend based on this and why
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started