Skip to main content
. 2022 Apr 29;22(9):3413. doi: 10.3390/s22093413
Algorithm 1: Divide and conquer
  • 1. Sort points along the x-coordinate.

  • 2. Split the set of points into two equal-sized subsets by a vertical line x=xmid.

  • 3. Solve the problem recursively in the left and right subsets. This will give the left-side and right-side minimal distances dLmin and dRmin, respectively.

  • 4. Find the minimal distance dLRmin among the pair of points in which one point lies to the left of the dividing vertical and the second point lies to the right.

  • 5. The final answer is the minimum among dLmin, dRmin, and dLRmin.