% computes Newton's divided differences, needs only a vector for storage
%
% Inputs
%   x 	interpolation nodes (maybe a vector)
%   f   function values
%
% Outputs
%   d	coefficients of Newton interpolation polynomial
%
%   One way ot test this is to run the following:
%      x  = linspace(0,5);
%      xd = [1 2 3 4];
%      yd = [-1 2 -2 5];
%   
%      d = newtondd(xd,yd);
%      y = newtonev(xd,d,x);
%      plot(x,y,xd,yd,'r+')


function d = newtondd(x,f)
n = length(x)-1;
if (length(f)~=n+1) fprintf('length of input vectors must be the same'); end;
d = f;

% TO BE COMPLETED.
% Please remember to use vectorized operations when evaluating polynomial
% in order to allow x to be a vector.
