Question: Determine the performance (big-O and ~) and result for abc .. Note: this is pseudo-code it should be intelligible, but not necessarily compilable or correct.
Determine the performance (big-O and ~) and result for abc..
Note: this is pseudo-code it should be intelligible, but not necessarily compilable or correct.
float[] abc(float[N] p, float[N] q, int N) {
float[N div 2] pl,ql,ph,qh,t1,t2; float[N] rl, rm, rh;
float[2N-1] result; int i, N2;
if (N=1) then
mult[0] = p[0]*q[0];
else {
N2 = N div 2;
for (i=0; i < N2; i++){ pl[i] = p[i];
ql[i]=q[i];
}
for (i=N2; i < N; i++){ ph[i-N2] = p[i];
qh[i-N2] = q[i];
}
for (i=0; i t2[i] = ql[i]+qh[i]; } rm = abc(t1,t2, N2); rl = mult(p1,ql, N2); rh = mult(ph,qh, N2); result[N-1] = 0; for (i=0; i result[N2+i] = = mult[n2+i]+rm[i]-(rl[i]+rh[i])) } return result; }
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
