int x[N];
Values in x[] are (rand()%10)+268435410, aka 268435410..268435419.
The algorith counts each individual value.
// v1.0 uses if( x[n] == ___ )'s
// v2.0:
int k[268435420] = {0}; // k uses almost 1GB of memory
for (n = 0; n N; n++) {
k[ x[n] ]++;
}
// v2.1:
int k[10] = {0};
[EMAIL PROTECTED] wrote:
int x[N];
Values in x[] are (rand()%10)+268435410, aka 268435410..268435419.
The algorith counts each individual value.
// v1.0 uses if( x[n] == ___ )'s
// v2.0:
int k[268435420] = {0}; // k uses almost 1GB of memory
for (n = 0; n N; n++) {
[EMAIL PROTECTED] writes:
int x[N];
Values in x[] are (rand()%10)+268435410, aka 268435410..268435419.
The algorith counts each individual value.
// v1.0 uses if( x[n] == ___ )'s
// v2.0:
int k[268435420] = {0}; // k uses almost 1GB of memory
for (n = 0; n N; n++) {
k[ x[n] ]++;