0

I am working on my research and it's computer related. I need to calculate how blocks in a file are close to each other (the distance between the blocks).

For example, if we have the following three blocks:

>line 5
Block 1
>line 20

>line 30
Block 2
>line 45

>line 60
Block 3
>line 90

Now, we have three blocks. The first one starts at line 5 in the file and ends at line 20, second block starts at line 30 and ends at line 45, and last block starts at line 60 and ends at line 90.

I was thinking to first get the distance between blocks [(60-45)+(30-20)] then divided by the number of lines from first block to last block (90-5).

So, in this case, I will have something like:

([(60-45)+(30-20)]/(90-5))*100 = (25/85)*100 = 29.41%

Not sure if this is correct or, I have a feeling that it is not correct and I am missing something.

Any help?

Arwa
  • 151
  • Are you trying to figure out the average distance between blocks, or the proportion of you file not taken up by blocks? – gung - Reinstate Monica Jun 17 '15 at 12:33
  • In overall, I am trying to figure out how close these blocks are in a file in percent. – Arwa Jun 17 '15 at 17:52
  • That doesn't make sense. Do you want to know the average distance as percentages of the total space? – gung - Reinstate Monica Jun 17 '15 at 18:18
  • Yes, I want to get the average distance as percentages of the total space (a file), but I am not sure about it and that's why I posted the question because I think I am doing something wrong but I don't know how to correct it. – Arwa Jun 17 '15 at 19:19

0 Answers0