Mathematical Foundation of Computer Science

(Chris Devlin) #1
DHARM

DISCRETE NUMERIC FUNCTIONS AND GENERATING FUNCTIONS 55


(vi) // a function for polynomial evaluation using Horner’s rule
int Poly2(int a[],int n, const &x)
{
int val = a[n];
for (int I = 1; I = n; I++)
val = val * x + a[n - I];
return val;
}
Free download pdf