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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T01:27:22+00:00 2026-05-27T01:27:22+00:00

Closest distance between two points(disjoint set) In the Bichromatic Closest Pair Problem, we are

  • 0

Closest distance between two points(disjoint set)

In the Bichromatic Closest Pair Problem, we are given a set R of red points and a set B of blue points in the plane. The problem is to return the pair of points, one red and one blue, whose distance is minimum over all red-blue pairs.

My algorithm is a kind of them.

1: If both R and B store only a constant number of points, sort the points according to <y , com- pute a bichromatic closest pair using a brute- force algorithm, and return.

2: Assume |R| >= |B|, otherwise reverse the roles of R and B.

3: Pick a random element r from R.

4: Find the closest element of b in B to r.

5: Compute the left envelope of disks having radius |rb| centered at each of the points in B.

6: Remove all elements of R that are outside the envelope.

I can’t think any idea which implementing to 4,5,6.

some reference said Graham’s algorithm. I think it cannot be a circle. and I want to know how I implement them.

and How to make envelope some kind of region? T T..

It is easy draw in a paper, but implementing is always hard to me. someone who advise in C++?

  • 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-27T01:27:22+00:00Added an answer on May 27, 2026 at 1:27 am

    We’re still using an L1 metric, right? Let’s assume that the red points have x <= 0 and the blue points have x >= 0.

    Every red-blue pair has a shortest path with at most three segments: one horizontal from the red point to the y-axis, one vertical on the y-axis, one horizontal from the y-axis to the blue point. It suffices to compute the intersection of the y-axis and the Voronoi diagram for the red points and then locate the projection of each blue point on the y-axis in the diagram (e.g., with binary search :P; it may be faster, however, to sort the blue points by y-coordinate and merge).

        |
    R****
        *
        *
        ******B
        |
        |y=0
    

    Let’s say that a red point R = (x, y) dominates another red point R’ = (x’, y’) iff x’ <= x (R is at least as close to the y-axis as R’) and |y – y’| <= x – x’.

    Lemma 1 If R dominates R’, then every point on the y-axis is at least as close to R as R’.

    Proof: let P = (x, y’). Essentially by hypothesis, d(R, P) <= d(R’, P). For every point Q on the y-axis, d(R’, Q) = d(R’, P) + d(P, Q) >= d(R, P) + d(P, Q) >= d(R, Q).

             |
             Q
             *
    R'**P*****
        *    |
        R    |
    

    Lemma 2 Let R1 = (x1, y1), R2 = (x2, y2), R3 = (x3, y3). Assume that y1 <= y2 <= y3. If R3 dominates R1, then R2 dominates R1 or R3 dominates R2. Symmetrically, if R1 dominates R3, then R1 dominates R2 or R2 dominates R3.

    Proof: we have x1 <= x3. There are three cases.

    Case 1: x2 < x1. In this case, x2 <= x3 and |y3 – y2| <= |y3 – y1| <= x3 – x1 <= x3 – x2, so R3 dominates R2.

    Case 2: x1 <= x2 <= x3. In this case, |y2 – y1| + |y3 – y2| = |y3 – y1| <= x3 – x1 = (x2 – x1) + (x3 – x2), so |y2 – y1| <= x2 – x1 and R2 dominates R1 or |y3 – y2| <= x3 – x2 and R3 dominates R2.

    Case 3: x3 < x2. In this case, x1 <= x2 and |y2 – y1| <= |y3 – y1| <= x3 – x1 <= x2 – x1, so R2 dominates R1.

    Lemma 3 Suppose that R dominates R’ and R’ dominates R. Then R = R’.

    Lemma 4 Suppose that R = (x, y) is dominated by no other red point. Then (0, y) is closer to R than every other red point.


    Together, the lemmas imply that by repeatedly eliminating all R’ with some neighbor R (in sorted order by y-coordinate) that dominates R’, we obtain the Voronoi cells in order.

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

Sidebar

Related Questions

This problem is a kind of closest pair between two disjoint set. Upperside picture
I'm looking for a function that can accurately represent the distance between two colours
Is it ok to compare distances in a classic way (distance between 2 points:
Given a set of points p , I would like to find a point
I know how to implement n log n closest pair of points algorithm (Shamos
I'm trying to sort a list of CLLocationDistance values by closest distance (ascending order).
The closest I've seen in the PHP docs, is to fread() a given length,
Given two convex polygons in 2D space, how would you go about constructing the
I'm using following sql code to find out 'ALL' poi closest to the set
Problem: I have two overlapping 2D shapes, A and B, each shape having the

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.