INT POLYEVAL (int Coeff [], INT N, Const INT & X) {INT Y = 1; INT Value = Coeff [0]; for (INT i = 1; i <= n; i ) {y * = x; Value = Y * COEFF [I];} return value;}
// Horner rule finds a polynomial value //p (xi )= (... (CN6X CN 1) * × cn-2) ** c 3) ** **X C0INT Horner (int Coeff [], INT N, Const Int & X) {INT Value = Coeff [N]; for (INT i = 1; I <= n; i ) value = value * x coeff [Ni]; Return Value;
Ref: << Data Structure, Algorithm & Applications >> P37 ~ 38