Sorting points

Let's talk about algorithms!

Moderator: Board moderators

Post Reply
marcink
New poster
Posts: 2
Joined: Fri Nov 12, 2004 8:41 pm

Sorting points

Post by marcink » Fri Nov 12, 2004 8:50 pm

Could anybody tell me how to write an efficent algo for sorting points if we are given their coordinates?

Maniac
Experienced poster
Posts: 105
Joined: Tue Oct 14, 2003 3:24 pm
Location: Utrecht, Holland

Post by Maniac » Sun Nov 14, 2004 3:27 pm

Yes, define a relation between the points and just use quicksort or a garantueed N log N algorithm for sorting.

Moha
Experienced poster
Posts: 216
Joined: Tue Aug 31, 2004 1:02 am
Location: Tehran
Contact:

Post by Moha » Mon Apr 10, 2006 12:29 pm

define each point as a pair, because pair has < operator, and sorting it by sort function.

Post Reply

Return to “Algorithms”