Answer the question
In order to leave comments, you need to log in
How to evaluate the degree of intersection of two ranges?
Good day to all.
The task looks like this. There are two arrays of values - O and B.
It is necessary to determine how "strongly" these arrays intersected by any quantitative value.
Right now there are only thoughts of evaluation through the minimum and maximum values of the range of arrays. For example, Omin, Omax, Bmin, Bmax are the minimum and maximum values in the specified arrays.
Let Bmin = 2, Bmax = 4, Omin = 3, Omax = 7. It is visually seen that the ranges of the extreme values O and B have intersected. There are suggestions to estimate the length of the intersection (in this case from 3 to 4) relative to the lengths of the arrays themselves.
Answer the question
In order to leave comments, you need to log in
1) Sort arrays.
2) Merge them into one.
3) Knowing the maximum and minimum values of the original arrays, get an intersection array (if the ranges intersect at all).
4) Come up with a metric. This can be the number of elements in the intersection, with or without repeating elements. You can also use the module of the boundary difference (length in the geometric sense). You can calculate various average values, median. Yes, whatever you can think of. Everything depends on the task.
You can do without merge, complicating the algorithm for the sake of efficiency. But at the initial stage it will be easier.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question