I need to find the no of ways of partitioning a number N as a sum of K non-negative numbers.
Zeroes are also needed to be included in the sum.
Ordering does matter.
Example-
For $N=2,K=3 $
There are $6$ ways {1,1,0},{1,0,1},{0,1,1},{2,0,0},{0,0,2},{0,2,0}
I need an efficient recursive relation for this ?
Yes. Either the first number is zero, and you want $k-1$ numbers adding to $n$, or the first number is not zero. In the second case, find $k$ numbers that add to $n-1$, then add $1$ to the first number.
So $F(n,k)=F(n,k-1)+F(n-1,k)$
Use that to build up a bunch of values of $F(n,k)$ for, say $n=1..4$, $k=1..4$.