Hi Dave, I don't think ur logic will cover all cases like (1,1)(-3,-3), (1,1) (2,2) a line connecting these points passes through origin,
i think the solution is, we need to compute the slope of the point at index i with origin and build a binary tree with theses slopes. but worst cases of this algo is N*N , if we try balancing the tree while inserting I guess it can be done in NlogN Thanks Vinay On Fri, Feb 25, 2011 at 9:20 AM, Gene <[email protected]> wrote: > Dave's solution is best if numerical error is possible. > > If the points are precise, you can also do it in linear time. Just hash > the points on abs(y/x). > > -- > You received this message because you are subscribed to the Google Groups > "Algorithm Geeks" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/algogeeks?hl=en. > -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
