144k views
5 votes
Develop a program that implements the POLYNOMIAL ADT using the LIST ADT. The POLYNOMIAL ADT is used to represent polynomials and the following operations defined on polynomials:1.Evaluate()(xp, z). Evaluates the polynomial )(xp at the point zx

User Notbad
by
4.5k points

1 Answer

6 votes

Answer:

Polynomial Zero() ::= return the polynomial p(x)=0

Boolean isZero(poly) ::= return (poly == 0)

Coefficient Coeff(poly , expon) ::= If (expon tex2html_wrap_inline93 poly) return its corresponding coefficient else return 0

Exponent LeadExp(poly) ::= return the degree of poly

Polynomial Remove(poly , expon) ::= If (expon tex2html_wrap_inline93 poly) remove the corresponding term and return the new poly else return ERROR

Polynomial SingleMult(poly , coef , expon) ::= return poly tex2html_wrap_inline105 coef x tex2html_wrap_inline107

Polynomial Add(poly1 , poly2) ::= return poly1 + poly2

Polynomial Mult(poly1 , poly2) ::= return poly1 tex2html_wrap_inline105 poly2

end Polynomial

User Tomas Dohnal
by
4.9k points