Closest Pair Algorithm