aspose file tools*
The moose likes Programming Diversions and the fly likes Math/Geometry brain teaser Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Other » Programming Diversions
Bookmark "Math/Geometry brain teaser" Watch "Math/Geometry brain teaser" New topic
Author

Math/Geometry brain teaser

Ryan McGuire
Ranch Hand

Joined: Feb 18, 2005
Posts: 1007
    
    3
You're given a random number of points randomly distributed along a line. Where is the point that minimizes the sum of the distances to the original points?

Don't provide the mathematical formula that yields the answer, but rather describe the location qualitatively.

How did you arrive at the answer?

Ryan
Warren Dew
blacksmith
Ranch Hand

Joined: Mar 04, 2004
Posts: 1332
    
    2
Hm ... seems to me half the time the answer is nonunique.
Jerry Young
Ranch Hand

Joined: Jun 15, 2004
Posts: 77
Any point on the line that has the same number of points to its right as the nubmer of points to its left.

You pair the points from the most left and most right, the second left and second right, ..., and you measure the sum of the distances of your chosen point to each pair, then you see this.
Ryan McGuire
Ranch Hand

Joined: Feb 18, 2005
Posts: 1007
    
    3
Originally posted by Jerry Young:
Any point on the line that has the same number of points to its right as the nubmer of points to its left.

You pair the points from the most left and most right, the second left and second right, ..., and you measure the sum of the distances of your chosen point to each pair, then you see this.


Bing bing bing, we have a winner.

Originally posted by Warren Dew:
Hm ... seems to me half the time the answer is nonunique.


True. If there are initially an even number of "random" points, then anywhere on the line segment between the two middle points will satisfy the "minimum total distance" condition.

Ryan
Geoffrey Falk
Ranch Hand

Joined: Aug 17, 2001
Posts: 171
    
    1
What is the probability distribution of the points? There is no such thing as a uniform distribution of n points on an infinite line.

Geoffrey


Sun Certified Programmer for the Java 2 Platform
Ryan McGuire
Ranch Hand

Joined: Feb 18, 2005
Posts: 1007
    
    3
Originally posted by Geoffrey Falk:
What is the probability distribution of the points? There is no such thing as a uniform distribution of n points on an infinite line.

Geoffrey


Point taken. Let's edit the problem so that first line is, "You're given a random number of points randomly distributed along a line segment."

Ryan
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Math/Geometry brain teaser