Real average filesize in a set of files...
Posted
by JD
on Stack Overflow
See other posts from Stack Overflow
or by JD
Published on 2010-03-08T09:34:28Z
Indexed on
2010/03/08
9:36 UTC
Read the original article
Hit count: 376
Hi,
I have an apparently "simple" problem but I can't find the solution for some reason...
I have n millions files of different sizes and I want to find the average filesize.
To simplify it, I grouped them in multiples of 16KB.
< 16 KB = 18689546 files
< 32 KB = 1365713 files
< 48 KB = 1168186 files
...
Of course, the simple (total_size / number of files) does not work. It gives an average of 291KB...
What would be the algorithm to calculate the real average...?
Thx, JD
© Stack Overflow or respective owner