Suppose you want to know the value of
when
has a particular value. Here is an example of a
really inefficient way to
evaluate the polynomial, once you've set
to a particular value
(e.g.
):
The zero polynomial evaluates to 0 for every
.
Implement the function eval specified in
Polynomial.h. Be sure
to check whether your result, or any of your intermediate results,
falls outside ![]()
INT_MAX (in which case you should return
INT_MAX). For a polynomial of order
, your function should
have complexity
.