[알고리즘] 조합, 중복조합

ERror.ASER·2021년 2월 20일
0

알고리즘

목록 보기
1/5
post-thumbnail

호출하는 코드도 !!!!! 나중에 수정

조합

static void combination(int cnt, int start) {
    if(cnt == R) {
        return;
    }
    
    for(int i = start; i<N; i++) {
        results[cnt] = i;
        combination(cnt+1,i+1);
    }
}

중복조합

static void combination(int cnt, int start) {
    if(cnt == N) {
        return;
    }
    
    for(int i = start; i<N; i++) {
        results[cnt] = i;
        combination(cnt+1,i);
    }
}
profile
지우의 블로그

1개의 댓글

comment-user-thumbnail
2021년 2월 22일

아ㅋㅋㅋ 이 정도로만 작성하면 되나요ㅜ

답글 달기