<7> Q2. 자료구조와 함께 배우는 알고리즘 입문 (C언어)
#include #include typedef struct { int max; int num; int *set; } IntSet; int InputSet(IntSet *s) { int i, j, k, a, b, max, temp; printf("원소의 개수 입력: "); scanf("%d", &s->max); if ((s->set = calloc(s->max, sizeof(int))) == NULL) { s->max = 0; return -1; } s->num = 0; for (int i = 0; i max; i++) { printf("%d(input 0 = exit) : ", i + 1); scanf("%d", &s->set[i]); if (s->set[i] == 0) break; s->num..
<6> Q24. 자료구조와 함께 배우는 알고리즘 입문 (C언어)
#include #include void fsort2(int a[], int n, int min, int max) { int i; int *f = calloc(max - min + 2, sizeof(int)); int *b = calloc(n, sizeof(int)); for (i = 0; i max); } fsort2(x, nx, min, max); puts("오름차순으로 정렬했습니다."); for (i = 0; i < nx; i++) printf("x[%d] = %d\n", i, x[i]); free(x); return 0; }