Generally what kind of algorithm is used to solve when dealing with overlapping data sets .
In the below problem set, we can see that region (point 2 to point 3) is common to both statement A and statement B.
Statement A : Point 1 to 3 --> Speed is 30kmph Statement B : Point 2 to 5 --> Speed is 50kmph
Goal is to reorganize the data by splitting the common data ranges and calculating the averages and show them as below.
Expected result :
1 to 2 -> 30 kmph 2 to 3 -> (30 + 50)/2 -> 40 kmph 3 to 5 -> 50 kmph