Closest Pair of Points

Find the two closest points using divide and conquer - O(n log n) complexity

Select Input

Choose a predefined test file or upload your own

Select a test file and click "Run Algorithm" to see the visualization

Algorithm Information

How it works:

  1. Sort points by x-coordinate
  2. Divide points into two halves
  3. Recursively find closest pairs in each half
  4. Find closest pair across the dividing line
  5. Return the minimum distance found

Time Complexity:

O(n log n) - much better than brute force O(n²)

Space Complexity:

O(n) - for storing sorted arrays