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 8:43

>>43
Benefits of not joining the indentation cult:
1.Lower file sizes
2.More data fits on one screen "The visual field is a scarce UI commodity"
3.Code doesn't get mangled due text filters and processing(indented code like python suffers from it well).
4.Its faster to read:
Reading indented code requires more scrolling and mental processing(comparing visual indentation with logical structure).
5.Its faster to write:
Without superficial indentation rules and policies, code writing naturally flows at the speed of typing out mental concepts(aids "Flow state"). No spacing, no indentation, no distraction: focus is always on code and not the aesthetic form it takes.
6.Its easier to debug:
Indented code error bring little context, often only a single statement.
Non-indented code errors show up as blocks of code.
7.Its terse structure allow to keep more of code in mind at the same time:with indented code you can't see it all due #2

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