My problem statement:
You are given N (N<=1000) points in X,Y co-ordinates. X and Y are both positive. Now, the problem is using maximum number of point you have to draw a straight line and also using maximum number of point you have to draw a 1/4 shape parabola. Actually, here you have to solve two problem at the same time. You can use any point to draw any one from those. You can use those point that are use to draw a straight line for 1/4 shape parabola.
Now all I need is your help to solve this problem. Please discuss your opinion.
You are given N (N<=1000) points in X,Y co-ordinates. X and Y are both positive. Now, the problem is using maximum number of point you have to draw a straight line and also using maximum number of point you have to draw a 1/4 shape parabola. Actually, here you have to solve two problem at the same time. You can use any point to draw any one from those. You can use those point that are use to draw a straight line for 1/4 shape parabola.
Now all I need is your help to solve this problem. Please discuss your opinion.
But what is a "1/4 shape" parabola?
Can I know how you solve the 2nd problem? I am not sure how you can use the hash table to solve it.
we can use floating numbers to nomalize vector,
let's divide both coordinates by vector's length. we can hash doubles too
or to put into hash table value (x / y) or (x * y^(-1) mod P)
(And by the way it's not said that coordinates are integer.)
Can you please explain how you can use gcd to solve the problem? I am not sure how you can use that to solve either the quadratic or linear problem.
Three points A, B, C lie on the same line if and only if (B_x - A_x) / (B_y - A_y) = (C_x - A_x) / (C_y - A_y).
(I don't want to talk about zeroes).
So, we fix A, reduce all the fractions (B_x - A_x)/(B_y - A_y) (divide both parts by their gcd), count maximal number of equal pairs (we can use hash table here), and thus we get the maximal number of points that lie on one line incident to A.
Check all points to find the answer.