Given: a lot of points each with a unique coordinate (xi,yi)
Output: Max number of points on the same line
This is my method:
for i=1..n
for j=i..n
get the line determined by point[i] and point[j]
for k=1..n
check if point[k] is on this line
But it seems this method takes too much time and always exceeds the time limit on the OJ system.
iterate each point, calculate the polar angle for each other point, sort the polar angle
this cost O(n^2*lgn)