摘要: 霍纳(Horner)规则是采用最少的乘法运算策略,求多项式 A(x) = a[n]x^n + a[n-1]x^(n-1) + ... + a[1]x^1 + a[0]x^0 在x处的值。该规则为 A(x) = (...((a[n]x + a[n-1])x + ... + a[1])x + a[0])。利用霍纳规则,编写C语言程序对多项式进行求值。解:分别用迭代和递归两种方法来实现,解题代码分别如下: 迭代:#include int horner(int *array, int n, int x){int result = array[n];while(n){result = result * 阅读全文
posted @ 2014-03-11 18:51 xiaoniu1024 阅读(613) 评论(0) 推荐(0) 编辑