Recursive Function value

29 Views Asked by At

Say I have f(x,y)=(f(x-1,y)*f(x,y-1)+1)%2 where $f(x,y)$ can be only 0,1 we are given $f(0,i)$ and $f(j,0)$ for all $1\leq i,j\leq n$ Now I need to compute $f(x,y)$ at some $x,y$ without actually taking out the value at all $f(i,j)$ therefore with minimum computation how can I take out $f(i,j)$ . Example :

  1 1
0 1 0
1 0 1

Say

$f(0,1)=1$

$f(0,2)=1$

$f(1,0)=0$

$f(2,0)=1$

then

$f(1,1)=1$

$f(1,2)=0$

$f(2,1)=0$

$f(2,2)=1$