I've written the code for finding the binomial coefficient in recursive form:
public int binom(int n, int k)
{
if (k==n || k==0)
return 1;
else return binom(n-1,k-1) + binom(n-1, k);
}
How can I rewrite this code in iterative form instead of recursive form?