2013/07/27

資料結構 Binomial coefficient(二項式係數)

有興趣可以參考一下Binomial coefficient




#include <stdio.h>
int count = 0;

int Binomial(int n, int m){
         count++;

         if( n == m || m == 0 )
                return 1;
         else
                return (Binomial( n - 1, m) + Binomial( n - 1 , m - 1 ));
}

int main()
{
         printf("Number:%d\n",Binomial(5,3));
         printf("Count%d\n",count);

        return 0;
}



參考資料:
http://en.wikipedia.org/wiki/Binomial_coefficient