September 2017 Update

This commit is contained in:
Ingy döt Net 2017-09-23 10:01:46 +02:00
parent bba7bfd280
commit ba8067c3b7
14570 changed files with 153136 additions and 63871 deletions

View file

@ -0,0 +1,16 @@
function closestpair(P::Vector{Vector{T}}) where T <: Number
N = length(P)
if N < 2 return (Inf, ()) end
mindst = norm(P[1] - P[2])
minpts = (P[1], P[2])
for i in 1:N-1, j in i+1:N
tmpdst = norm(P[i] - P[j])
if tmpdst < mindst
mindst = tmpdst
minpts = (P[i], P[j])
end
end
return mindst, minpts
end
closestpair([[0, -0.3], [1., 1.], [1.5, 2], [2, 2], [3, 3]])