Polynomial evaluation

xiaoxiao2021-03-05  25

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

转载请注明原文地址:https://www.9cbs.com/read-32245.html

New Post(0)