Assume that I have a dataset with numbers (start, stop):
4556745 , 4556749
4556749 , 5078554
… and so on
I want to make a chunk of code in order to print the range (start, stop) in which the max overlapping is occurred. Till now I have managed to calculate the max number of occurrences but not the range in which they are in.
My pseudocode – logic is like this :
maxoverlap = zero
currentoverlap = zero
i equals zero
j equals zero
m equals len(in_mumbers)
n equals len(out_numbers)
while (I less_than m and j less_than n):
if (in_numbers[i] less_than out_numbers[j])
currentoverlap equals currentoverlap + 1
maxoverlap equals max(maxoverlap, currentoverlap)
i equals i + 1
else:
currentoverlap equals currentoverlap - 1
j = j + 1
print maxoverlap
is there any idea, suggested readings e.t.c?