Anonymous user
Closest-pair problem: Difference between revisions
m
fix Swift version
m (→{{header|REXX}}: added whitespace.) |
m (fix Swift version) |
||
Line 4,337:
guard xP.count > 3 else { return xP.closestPairBruteForce() }
let
let
let
let xm = xl.last!.x
let (yl, yr) = yP.reduce(into: ([Element](), [Element]()), {cur, el in
if el.x > xm {
Line 4,384 ⟶ 4,385:
guard count != 2 else { return (minDistance, closestPoints) }
for i in 0..<count
for j in i+1..<count {
let (iIndex, jIndex) = (index(startIndex, offsetBy: i), index(startIndex, offsetBy: j))
|