What does this recursive function does in mathematical therms?

30 Views Asked by At

Having this recursive function :

int F(int n, int m){
    if(m == 0 || m == n)
        return 1;
    return F(n-1, m-1) + F(n-1, m);
}

what is the effect of the function?

For the example, F(15, 13) returns 105. I'm struggling to find the answer but i couldn't resolve this.

1

There are 1 best solutions below

0
On BEST ANSWER

$$F(n,m) = \binom{n}{m}.$$

The function $F(n,m)$ computes the $m$th entry in the $n$th row of Pascal's triangle (if you count starting at $0$).