polynomial evaluation time complexity

Viewed 4821

I was going through this link :
http://www.geeksforgeeks.org/horners-method-polynomial-evaluation/

Here it says that the time complexity using normal method is O(n^2).But I wonder how?Here is my analysis about this:

Suppose we have an equation like:2x^2 + x + 1
Here the for loop will be executed 3 times i.e.(order+1)times

    for(int i = order ; i>=0 ; i++){
         result = result + (mat[i] * coefficient^i);
    }

So according to this ,the time complexity should be O(n+1) i.e. O(n).Why does it say that its O(n^2)?I'm getting a little lost here.Even a hint would do.

3 Answers
Related