buildKDTree

expect fun <T> buildKDTree(items: MutableList<T>, dimensions: Int, mapper: (T, Int) -> Double): KDTreeNode<T>(source)

Builds a KD-Tree from a mutable list of items, using a mapper function to extract coordinate values for the specified dimensions.

Return

The root node of the constructed KD-Tree.

Parameters

items

A mutable list of items to be included in the KD-Tree.

dimensions

The number of dimensions to consider in the KD-Tree.

mapper

A function that maps an item and a dimension index to a coordinate value.

actual fun <T> buildKDTree(items: MutableList<T>, dimensions: Int, mapper: (T, Int) -> Double): KDTreeNode<T>(source)
actual fun <T> buildKDTree(items: MutableList<T>, dimensions: Int, mapper: (T, Int) -> Double): KDTreeNode<T>(source)