Algorithm for evaluating polynomials
The number of multiplications in the algorithm is $2n - 1$, but the number of multiplications in the Horner's method is $n$, which means this algorithm is not optimal.
As mentioned in the Wiki page, Horner's method in evaluating a polynomial is optimal, therefore we can change this algorithm so that it uses the Horner's method.
p = a[n]

for i = n-1 to 0:
   p = p.x + a[i]