콤비네이션(C) 알고리듬 참조:  http://stackoverflow.com/questions/2201113/combinatoric-n-choose-r-in-java-math 

 

int nCk = 1;
       
for (int k = 0; k < K; k++) {
           
System.out.print(nCk + " ");
            nCk
= nCk * (n-k) / (k+1);
       
}

예) 5C3 =   5/1 * 4/2 * 3/3  =  10..

 

중복 콤비네이션(H) 참조: https://ko.wikipedia.org/wiki/%EC%A1%B0%ED%95%A9 

    개의 빈칸에 중복을 허용하여 개의 원소를 넣는 개수로 생각할 수 있다.?

      즉, 개의 칸막이를 두고 가지 경우를 임의의 순서로 배열하는 것.?

 

      nHk = (n+k-1)C(n-1) = (n+k-1)Ck

 

 

Posted by yongary
,