Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
|
|
@ -0,0 +1,19 @@
|
|||
Procedure.d bruteForceClosestPair(Array P.coordinate(1))
|
||||
Protected N=ArraySize(P()), i, j
|
||||
Protected mindistance.f=Infinity(), t.d
|
||||
Shared a, b
|
||||
If N<2
|
||||
a=0: b=0
|
||||
Else
|
||||
For i=0 To N-1
|
||||
For j=i+1 To N
|
||||
t=Pow(Pow(P(i)\x-P(j)\x,2)+Pow(P(i)\y-P(j)\y,2),0.5)
|
||||
If mindistance>t
|
||||
mindistance=t
|
||||
a=i: b=j
|
||||
EndIf
|
||||
Next
|
||||
Next
|
||||
EndIf
|
||||
ProcedureReturn mindistance
|
||||
EndProcedure
|
||||
Loading…
Add table
Add a link
Reference in a new issue