PTU Solved Assinment
MCA - 302 Data Structure: Unit 1
I'm not posting Questions here. Please refer to the SIM from PTU
Review Question No3. Horner's rule:
/*Assume that the polynomial Co-eff are stored in an array a(n)*/
i = n;
s = 0;
while (i>=0)
{
s = s*x + a[i];
i = i - 1;
}
Review Question No 4 Ackermann's function A(m,n) is defined as follows:
int A(int m, int n)
{
if (m==0)
return (n+1);
else if (n==0)
A(m-1,1);
else
A(m-1,A(m,n-1));
}