Let consider the following algorithm: Polynomial evaluation P(x) = \sum_{k=0}^n c_k x^{n-k} At the point t. Solve the recurrence relation.

Kyran Hudson

Kyran Hudson

Answered question

2021-08-09

Let consider the following algorithm: Polynomial evaluation
This algorithm evaluates the polynomial
P(x)=k=0nckxnk At the point t.
Input: The sequence of coefficients C0,C1,,Cn, the value tandn
Output: p(t)
Procedure poly(c, n, t)
If n=0 then
Return (c0)
Return (t:poly(c,n1,t)+cn)
End poly
Let bn, be the number of multiplications required to compute p(t).
a) Find the recurrence relation and initial condition for the sequence {bn}
b) Compute b1,b2andb3.
c) Solve the recurrence relation.

Answer & Explanation

Jayden-James Duffy

Jayden-James Duffy

Skilled2021-08-10Added 91 answers

For any n=1, the algorithm recurses as follows:
p(t)=c1+tpoly(c,0,t)(from the lineReturn(tpoly(c,n1,t)+cn))
c1+c0t
In general, for any n, the algorithm evaluates the polynomial as follows:
p(t)=cn+tpoly(c,n1,t)
=cn+y(cn1+tpoly(c,n2,t))
=cn+t(cn1+t(cn2+tpoly(c,n3,t)))
This continues till n-n =0 and the algorithm finally returens c0. SO, the general form of polynomial evaluation is
p(t)=cn+t(cn1+t(cn1+t(cn2++t(cnk+t(cnk1++t(c0))))))
which gives p(t)=cn+cn1t+cn2t2++c0tn
a) bn is the number of multiplications required to compate p(t)
When n=0,p(t)=c0. There is no multiplication involved. This is b0.
When n=1,p(t)=c1+c0t. One multiplication is required. This is b1
Continuing for any other n, p(t)=cn+tpoly(c,n1,t), we see that
bn1 multiplications are required for poly(c,n1,t).
An additional 1 multiplication is required for multiplying t and poly(c,n1,t).
Therefore, the recurrence relation is
bn=bn1+1
And the intial condition is b0=0, because no multiplication is performed when n=0
bn=bn1+1,b0=0

Do you have a similar question?

Recalculate according to your conditions!

New Questions in Discrete math

Ask your question.
Get an expert answer.

Let our experts help you. Answer in as fast as 15 minutes.

Didn't find what you were looking for?