Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8727567
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T08:27:23+00:00 2026-06-13T08:27:23+00:00

Given 3 points in a grid, how would you find a point such that

  • 0

Given 3 points in a grid, how would you find a point such that sum of distances of this point from all 3 points in minimized. An obvious answer to this problem is Fermat’s triangle. I am interested in knowing if we can locate Fermat’s point using a breadth first search algorithm in a graph.

struct node{
  int Person1X,Person1Y,Person2X,Person2Y,Person3X,Person3Y; //X and Y coordinates of all 3 persons
  int steps;   //sum of distances covered by all 3 person to reach this state
}

While doing the BFS we could put a constraint,
if steps>min(sum of any two edges of the triangle with 3 persons as vertices) return;

if(Person1X=Person2X=Person2X)AND(Person1Y=Person2Y=Person3Y) return steps;
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T08:27:24+00:00Added an answer on June 13, 2026 at 8:27 am

    No search is necessary.

    Given “triangle” ABC:
    SumOfDistances( p ) = dist( A, p ) + dist( B, p ) + dist( C, p )

    where dist( q, p ) = |qx-px| + |qy-py| (Manhattan distance)

    you can see that SumOfDistances( p ) = SumOfDistancesx( p ) + SumOfDistancesy( p )

    So, you can minimize by the distance on the x and y axis independently.

    So, the Fermat point’s x-coordinate is the median of the 3 given x-coordinates.
    The Fermat point’s y-coordinate is the median of the 3 given y-coordinates.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Given N points in a 3D space, how to find the smallest sphere that
Problem: Given a list of spheres, find all empty spaces that are completely enclosed
Given a grid of points I'm trying to find the path between two of
I want to draw an area from given points on a map using the
You are given a list of distances between various points on a single line.
I have a 2D grid (G= 250x250) and just about 100 points of this
Given that every grid, combobox, checkboxlist and in general multi row control supports binding
I wish to find the point with the minimum sum of manhattan distance/rectilinear distance
Given two points in 3D space, A and B, I get a line segment
There is a points given in two dimensional plane and I want to count

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.