| Safe Haskell | None |
|---|---|
| Language | GHC2021 |
AtCoder.Extra.KdTree
Contents
Description
Static, \(k\)-dimensional tree \((k = 2)\).
- Points are fixed on
buildand cannot be moved or added later. - Multiple points can exist at the same coordinate.
Examples
>>>import AtCoder.Extra.KdTree qualified as KT>>>import Data.Vector.Unboxed qualified as VU>>>let xys = VU.fromList [(0, 0), (1, 1), (4, 2)]>>>let kt = KT.build2 xys>>>-- Find point indices in [0, 2) x [0, 2) with maximum capacity 3>>>KT.findPointsIn kt 0 2 0 2 3[0,1]
>>>KT.findNearestPoint kt 3 3Just 2
Since: 1.2.2.0
K-dimensional tree
Static, \(k\)-dimensional tree \((k = 2)\).
Since: 1.2.2.0
Constructors
| KdTree | |
Constructors
\(O(n \log n)\) Creates a KdTree from \(x\) and \(y\) vectors.
Constraints
- \(|\mathrm{xs}| = |\mathrm{ys}|\).
Since: 1.2.2.0
\(O(n \log n)\) Creates KdTree from a \((x, y)\) vector.
Since: 1.2.2.0