Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Huffmanashi No Naku Koro Ni

Name: Cudder !cXCudderUE 2017-03-04 4:12

int kod(int *cnts, int i, int *j, int *k, int nsyms) {
int r;
if(*k > nsyms || i > *j && cnts[*j] < cnts[*k]) {
r = cnts[*j];
cnts[(*j)++] = i;
} else
r = cnts[(*k)++];
return r;
}

int huff(int *cnts, int nsyms) {
int i = 0, j = 0, k = 0;
for(i=0;i<nsyms-1;i++)
cnts[i] = kod(cnts, i, &j, &k, nsyms) + kod(cnts, i, &j, &k, nsyms);
cnts[i] = 2;
j = i-1;
k = j;
while(k) {
while(j > 0 && cnts[j-1] >= k)
j--;
cnts[i--] -= k - j;
cnts[i] = (k - j)*2;
k = j;
}
return nsyms - i;
}

Name: Anonymous 2017-07-18 15:53

>>77,78
Someone salty about their bloated indentation wasting space.

Name: Anonymous 2017-07-18 15:57

>>52
Thats the right choice 11 lines of pure code. Keep up the good work.

Name: Anonymous 2017-07-18 16:01

Adding 20 lines of bloat

#include < stdio.h >
#include < string.h >
int main(int argc, char ** argv) {
int i;
if (argc != 2) {
fprintf(stderr, "usage: %s string\n", argv[0]);
return 1;
}
if (!strcmp(argv[1], "//")) {
goto step_6;
};
if (!argv[1][0]) {
goto single_dot;
}
for (i = 0; i < strlen(argv[1]); i++) {
if (argv[1][i] != '/') goto notslash;
}
goto single_slash;
notslash: for (i = strlen(argv[1]) - 1; argv[1][i] == '/'; i--) {
argv[1][i] = 0;
}
if (strrchr(argv[1], '/')) {
for (i = strlen(argv[1]) - 1; argv[1][i] && argv[1][i] != '/'; i--) {
argv[1][i] = 0;
};
step_6: for (i = strlen(argv[1]) - 1; argv[1][i] && argv[1][i] == '/'; i--) {
argv[1][i] = 0;
}
if (argv[1][0]) {
printf("%s\n", argv[1]);
} else {
single_slash: printf("/\n");
}
} else {
single_dot: printf(".\n");
};
return 0;
}

Name: Anonymous 2017-07-18 16:04

>>82
Disgusting and wasteful.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List