There are many points in x, y coordinates and I'd like to get a straight line which contains as many points as possible..
I only have O(n^3) solution.. Is there any more efficient way..?
Thanks..
I think that you can get to worst-case O(N^2) using point-line duality. Transform the problem into "given N different lines, find the largest subset that pass through the same point", and then traverse the whole plane subdivision given by the N lines, and look for a vertex with the largest degree.
Of course, this is just a theoretical result, not what I'd (want to) implement. mf's suggestions are way easier to implement.