Deadline:
Write a program for computing
(1) x^n, and
(2) f(x) for x=1, 2, ... , n where f(x)=a0+a1x^1+a2x^2+ ... ak-1x^(k-1)
Please compare your naive algorithms against the well-known ones you might find by comparing the performances of them when running, say,100000000, times .
•Input: x, n
•Output: x^n
•Input: k, n, a[0], a[1], … , a[k-1] (a[i]'s may be read from a file, generated randomly, assigned by Edit's via UI, etc.)
•Output: f(1), f(2), … , f(n) where
f(x) = a[0] + a[1]x + a[2]x^2 + … + a[k-1]x^(k-1)