Hi team
Just wondering if there is a algorithm that can identify the mid points of two groups of data. These two group of data are not evenly distributed, so I can sum them up and find the average.
So here is what I mean:
So say I run this code for a minutes or two, I got this data (these are real data):
Now I can count the empty ones and work out the mid-point is data[80], but how can I do it with an fast algorithm in real time? And maybe don't need to use that much ram?
Just wondering if there is a algorithm that can identify the mid points of two groups of data. These two group of data are not evenly distributed, so I can sum them up and find the average.
So here is what I mean:
C:
void main(){
uint32_t data[256] = {0};
uint8_t val = 0;
for(;;){
/* a magical function to read the positive
* pulse of a eletronics signal. This is a
* blocking function for simplicity.
*/
val = readPositivePulseOfSignal();
data[val]++;
}
}
C:
data[0] = 0;
data[1] = 0;
...
data[61] = 0;
data[62] = 0;
data[63] = 249750;
data[64] = 5307291;
data[65] = 9838050;
data[66] = 5433023;
data[67] = 219066;
data[68] = 0;
data[69] = 0;
...
data[91] = 0;
data[92] = 0;
data[93] = 23;
data[94] = 3178823;
data[95] = 32018044;
data[96] = 9601470;
data[97] = 44613;
data[98] = 0;
data[99] = 0;
...
data[254] = 0;
data[255] = 0;