Re: [Tutor] Sorting points on a 2D plane

2009-10-30 Thread Shashwat Anand
@Robert: You can look for a similar problem here : https://www.spoj.pl/problems/BSHEEP/ For algorithm I suggest you to go for Graham's scan or Quick hull. On Sat, Oct 31, 2009 at 1:39 AM, Robert Berman wrote: > Hello Shashwat, > > I have saved the web page for a much more detailed review aft

Re: [Tutor] Sorting points on a 2D plane

2009-10-30 Thread Robert Berman
Hello Shashwat, I have saved the web page for a much more detailed review after I work through the suggestions given by Alan et all. It is obvious that a casual read is not going to be enough. Thank you for the information. Robert On Fri, 2009-10-30 at 23:49 +0530, Shashwat Anand wrote: > The

Re: [Tutor] Sorting points on a 2D plane

2009-10-30 Thread Shashwat Anand
The problem belongs to 'Convex Hull' superset. look into : http://en.wikipedia.org/wiki/Convex_hull_algorithms On Thu, Oct 29, 2009 at 6:05 PM, Robert Berman wrote: > > Kent and Alan, > > Thank you both for providing me with tools I can use to develop the sort > portion of my algorithm. They ar

Re: [Tutor] Sorting points on a 2D plane

2009-10-29 Thread Robert Berman
Kent and Alan, Thank you both for providing me with tools I can use to develop the sort portion of my algorithm. They are invaluable. I really appreciate Luke's willingness to examine and advise on the full algorithm and once it is written (only the function that determines distance between two p

Re: [Tutor] Sorting points on a 2D plane

2009-10-28 Thread Kent Johnson
On Wed, Oct 28, 2009 at 1:34 PM, Robert Berman wrote: > Hi, > > I am working on a practice problem called 'POINTS' on the CodeChef > site:http://www.codechef.com/problems/POINTS/. This simply wants the sum > of the distances between a number of points on a 2 dimensional plane. > Looking at the pro

Re: [Tutor] Sorting points on a 2D plane

2009-10-28 Thread Alan Gauld
"Robert Berman" wrote constructed. My point of confusion is in ordering the points. Given a very simple example set of points: The arrangement should be, 0 5 0 2 0 1 2 3 2 1 5 2 5 1 You might find the itertools.groupby function does most of what you need? HTH, Alan G. __

Re: [Tutor] Sorting points on a 2D plane

2009-10-28 Thread Luke Paireepinart
Oops I replied off list twice. (i wish they would just munge the addresses *grumble**grumble*) On Wed, Oct 28, 2009 at 11:34 AM, Robert Berman wrote: Hi, What I am looking for is a better, faster approach. I think there would be a way to build a dictionary but you can't use the X values as keys