Given an array of 2D points (x,y coordinates), find the closest pair of points.
The distance between two 2D points can be calculated using the formula
from math import sqrt dx = (x2 - x1) dy = (y2 - y1) dist = sqrt(dx**2 + dy**2)
Given an array of 3D points (x,y,z coordinates), find the closest pair of points.
The distance between two 3D points can be calculated using the formula
from math import sqrt dx = (x2 - x1) dy = (y2 - y1) dz = (z2 - z1) dist = sqrt(dx**2 + dy**2 + dz**2)
Assuming Euclidean space, what about 4D, 5D, ...?
Let the user chooses between using points in a file or points generated randomly.
Note: Predefined points in a file makes debugging easier. Tests can be repeated using the same input.
See the Python documentation for "random.randint"