K
K
koliane2020-05-15 16:42:12
Mathematics
koliane, 2020-05-15 16:42:12

How to find the maximum between two points on a discrete graph?

given a graph of points. It is necessary to find the maximum value between any two points (including these extreme points themselves).

The task is programmatic, so any "meta-information" necessary for calculations can be added to each point. Those. data can be prepared by initially adding some meta-information (if needed).
I can't store the maximums for all combinations, because there are more than a million points, and there will be too many combinations.

Those. at the input of the program - two points (with values ​​at these points and meta-information). I only need to get the maximum based on these data.

Example:
c4dc3f7a54.jpg
Let's take a pair of points with serial numbers {1,4}. Here the maximum value between them = 4.
Let's take a pair of points with serial numbers {4,5}. Here the maximum value between them = 3.

Are there any algorithms for this? Can this be done at all?

Answer the question

In order to leave comments, you need to log in

4 answer(s)
A
Armenian Radio, 2020-05-15
@gbg

On a discrete graph, the maximum can only be at the nodal point.

R
Rsa97, 2020-05-15
@Rsa97

At each point, store an array of maximums to the right of it. Then search until the end of the interval to find the value.
1:{1:1, 2:2, 3:4}
2:{2:2, 3:4}
3:{3:4}
4:{4:0.3, 5:3}
5:{5:3 }
6: {6: 1}
{1, 4} => Take the array at point 1, move along it, the nearest less than 4 - 3. Maximum 4.

D
Danil Tunev, 2020-05-16
@lada-guy

Come on, don't call your drawing discrete! There is a section in mathematics related to vectors, the formulas there are simple and do not require a lot of computer resources

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question