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 6778467
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T16:16:10+00:00 2026-05-26T16:16:10+00:00

I have a quick question that I haven’t found out how to do efficiently

  • 0

I have a quick question that I haven’t found out how to do efficiently (in C#).

I have a list array of Points (X,Y). I need to find which 3 points are the tightest cluster. It’s for a mapping project.

What would the best way to do this be? There’s only about 6 to 9 items in the list.

Thanks in advance.

Cheers!

  • 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-05-26T16:16:11+00:00Added an answer on May 26, 2026 at 4:16 pm

    For such small numbers, the brute force method should work just fine. With six points, there are 20 possible combinations of three points. With 9 points, there are 84 possible combinations. I wouldn’t recommend this approach for a lot of points, but with just a handful, it’s going to be plenty fast enough and it’s dead simple to write.

    You can easily generate the combinations:

    for (int i = 0; i < points.Length - 2; ++i)
    {
        for (j = i + 1; j < points.Length - 1; j++)
        {
            for (k = j + 1; k < points.Length; k++)
            {
                // Here, your three points are
                // points[i], points[j], and points[k]
                // compute "tightness" and store
            }
        }
    }
    

    You’ll need a structure to hold your combinations:

    struct PointGroup
    {
        public readonly int i;
        public readonly int j;
        public readonly int k;
        public readonly double tightness;
        public PointGroup(int i, int j, int k, double tight)
        {
            this.i = i;
            this.j = j;
            this.k = k;
            this.tightness = tight;
        }
    }
    

    If you create one of those structures for each group and store them in an array, you can simply sort the array and take the best three.

    Your bigger problem is coming up with a definition of “tight group.” Also, you have to decide if a point can be in more than one of those “tightest” groups. Three possible ways to define tightness are:

    • The sum of the distances between the points is minimized.
    • The average distance from each point to the center of the group is minimized.
    • The circumference of the triangle formed by the three points is minimized.

    Undoubtedly there are more.

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

Sidebar

Related Questions

I have a quick question that I could not figure out in the docs
I have a quick question that I need some help with if possible. Am
I have a quick question that I can't figure out. I've tried searching Google
Quick question... I have a query that checks for duplicates that looks like this:
Quick question. I have an app that use a native DLL through PInvoke, this
just a question that needs a quick answer, I have a Action, lets say,
Hey guys quick question, I have an entry that I put in my database,
Hey guys quick question. I have a div that gets assigned a number to
Quick question. What do you think, I have a few sites that use a
Quick question that requires a long explanation.. Say I have two tables - one

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.