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-17 7:06

>>32
I don't think you understand the purpose of indentation very well.
You might think it's meaningless and have learned to get used to it, but at a glance, looking at your code to find something and identify structures becomes difficult. Then when others start reading your code they too will find it very hard to read compared to others' code.

Sure they can run ident(1), but are there really many notable benefits to foregoing indentation? All I can think of is saving file size, but that's a poor argument. Formatting your code should be an effortless part on yourself, and doesn't require you to be a ``code artisan'' to accomplish. Just think of how many people who looked at your code for 5 seconds and in the end just thought you are an amateur Apper without analyzing your techniques indepth.

So don't think it will only affect you. With almost all code people see being well formatted, it's hard to think they'll be ok with formatting some guy's code themselves just because he is kinda narcissistic.

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