Skip to content

Instantly share code, notes, and snippets.

@kartikkukreja
Last active August 29, 2015 14:04
Show Gist options
  • Select an option

  • Save kartikkukreja/a1baa687d37582e82a93 to your computer and use it in GitHub Desktop.

Select an option

Save kartikkukreja/a1baa687d37582e82a93 to your computer and use it in GitHub Desktop.
Closest Pair of Points Problem
let P be the array of N points
minDist = infinity
for i = 1 to N-1
for j = i+1 to N
if dist(P[i], P[j]) < minDist
minDist = dist(P[i], P[j])
closestPair = (P[i], P[j])
return closestPair
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment