Question: A function called addterm with three parameters: a polynomial P, an exponent exp, and a coefficient coeff. This functions adds to the polynomial P a
A function called addterm with three parameters: a polynomial P, an exponent exp, and a coefficient coeff. This functions adds to the polynomial P a term with exponent exp and coefficient coeff. If a term with this exponent already exists, the new term is simply added on to it. For example, if P is the polynomial 4x 3 + 13x 2 + 4, then addterm(P, 5, 6) adds the term 6x 5 to P, so that P is now 6x 5 4x 3 + 13x 2 + 4. Subsequently, addterm(P, 2, -3) causes P to become 6x 5 4x 3 + 10x 2 + 4. Keep in mind that if addterm increases the degree of the polynomial (as is the case in the first example above), you will need to increase the length of the list P and fill its elements appropriately. Similarly, if addterm decreases the degree of the polynomial, you will need to decrease the length of the list P appropriately.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
