@DanielFischer Ok, I will just use it...
1.l<-0
2.j<-m
3.while j>=0{
4. l+=pow(x,j)*a_j;
5. j-=1;
6. }
We suppose that additions, multiplications and assignments require a constant time.
The while loop is executed m+1 times and the function pow(x,j) performs exactly j-1 multiplications to find the jth power.
So the time complexity is $\sum_{j=0}^m (d+j-1)=\sum_{j=0}^m (d+1)+ \sum_{j=0}^m j=(d+1)(m+1)+ \frac{m(m+1)}{2}=\Theta(m^2)$.
So this algorithm is worse than the first one.