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?