Efficient Longest arithmetic progression for a set of linear Points?

You could study the Fast Fourier Transform methods for multiplication O(N log N).

You could study the Fast Fourier Transform methods for multiplication. O(N log N) You might be able to do something similar with your problem.

Thanks. May take some time to go through it. I will get back once I am done reading it.

– Abhijit Dec 20 at 12:19.

Firstly, your definition of distance is wrong. You have to take the square root. Secondly, if you know that all the points lie on a straight line, you can simply ignore the y-coordinates (unless the line is vertical) or the x-coordinates (unless the line is horizontal).

Then it reduces to the problem in your first paragraph.

1 I know the definition of distance is wrong. I just don't want to add an overhead of finding the square root which won't add any value but just to conform with the definition. Secondly I can strip of the y-coordinate but the points may line along X or Y axis.

Also I just can't remember the term they call for square of a distance so just calling it distance for the sake. – Abhijit Dec 20 at 12:18 Did you read my third sentence all the way to the end? – TonyK Dec 20 at 12:21 Sorry I should have been more elaborate with my previous comment.

Actually this is part of a larger problem, where there are some points on a plane that I have to group in a way that they are all linear and then I have to figure this out. Currently both of these I am doing in one iteration. – Abhijit Dec 20 at 12:24.

To sum things up: As @TonyK pointed out, if you assume that the points lie on a straight line, you can reduce it to the one-dimensional case that was discussed extensively here already. The solution uses Fast Fourier Transforms as mentioned by @YochaiTimmer. Additional note: The problem is almost certainly not NP-hard as it has an efficient O(n log n) solution, so that would imply P=NP.

Thanks. I need some time to go through it and see if I can extend the concept beyond three evenly spaced points. – Abhijit Dec 20 at 12:32 It is O(n log n) where n is the distance between the extreme points (assuming all distances are integers).

But it is O(n^2) in the number of points. – TonyK Dec 20 at 12:36 Just wondering if the said algorithm can be extended beyond 3 points. I am still brainstorming on that.

If its O(n^2) for the number of points, do we get any advantage of using it, assuming the above algorithm I mentioned is actually O(n^2) where n is the number of points in the linear space. – Abhijit Dec 20 at 13:19.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions