Question: Let f ( x ) , g ( x ) be two polynomial functions given by f ( x ) = a 0 + a
Let be two polynomial functions given by cdots
and cdots
a pts Write an algorithm called PolyAdd in pseudocode to com
pute where and are given as arrays
with and The indexing goes from here instead of ; the
lengths of these arrays are respectively and The result should
be returned as an array which stores its coefficients, and its size
b pts Analyze the running time of PolyAdd You may assume
that and give your result in terms of
c pts Write an algorithm PolyMult in pseudocode to compute
where and are given as before. An array
defining and its size should be returned. Justify the correctness of
your algorithm. What loop invariant does your algorithm maintain?
d pts Analyze the running time of Poly You may assume
that and give your result in terms of
e pts Now assume that the first input polynomial is always sparse, ie
we know that will be nonzero for at most values of where is a constant.
Modify the algorithm from part c to create SparsePolyMult which
takes advantage of the sparsity of Write pseudocode for this algorithm or
clearly note how to modify PolyMult Assuming analyze
the running time of SparsePolyMult ; the running time should be
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
