@Meng Yan: s is an array of real numbers, not integers, so perhaps a
counting sort is not applicable.

Dave

On Oct 23, 10:51 pm, Meng Yan <mengyan.fu...@gmail.com> wrote:
> Thank you!
> By the way, to do the 'sort s(i+1:n)', if I use counting sort, I think it
> should be better.
> --------------------------------------------------------------------
> imax = 0 // location of longest string of duplicate slopes
> lmax = 0 // length of longest string of duplicate slopes
> smax = undefined // value of slope
> for i = 1 to n-1
>     for j = i+1 to n
>         s(j) = slope of the line through points i and j
>     end for j // O(n)
>    ***************** sort s(i+1:n) // O(n log n)  *******************
>     scan s(i+1:n-1) looking for the longest string of duplicates //
> O(n)
>
>
>
> On Sat, Oct 23, 2010 at 10:32 PM, Dave <dave_and_da...@juno.com> wrote:
> > I gave an O(n^2 log n) algorithm to find the maximal number of
> > collinear points in a set is given in
> >http://groups.google.com/group/algogeeks/msg/d329dda12b332dd1.
> > A fairly simple modification could answer the question as to whether
> > any three points are collinear.
>
> > Dave
>
> > On Oct 23, 6:31 pm, Meng Yan <mengyan.fu...@gmail.com> wrote:
> > > Given n point on the plane, find out whether any 3point on the same line.
>
> > > How to use recursion to solve the problem? Could you help me find the
> > > algorithm and give the time complexity?
>
> > > Bests,
> > > Claire
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Algorithm Geeks" group.
> > To post to this group, send email to algoge...@googlegroups.com.
> > To unsubscribe from this group, send email to
> > algogeeks+unsubscr...@googlegroups.com<algogeeks%2bunsubscr...@googlegroups­.com>
> > .
> > For more options, visit this group at
> >http://groups.google.com/group/algogeeks?hl=en.- Hide quoted text -
>
> - Show quoted text -

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algoge...@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.

Reply via email to