Practica 6 de Laboratorio - KD Tree 2
Practica 6 de Laboratorio - KD Tree 2
06 K-d Tree 10
1. OBJETIVOS
2. TEMAS A TRATAR
● K-d Tree
3. MARCO TEÓRICO
K-D TREE
(Extraido de: https://www.geeksforgeeks.org/k-dimensional-tree/)
A K-D Tree(also called as K-Dimensional Tree) is a binary search tree where data in each node is a
K-Dimensional point in space. In short, it is a space partitioning(details below) data structure for
organizing points in a K-Dimensional space.
A non-leaf node in K-D tree divides the space into two parts, called as half-spaces.
Points to the left of this space are represented by the left subtree of that node and points to the right of
the space are represented by the right subtree. We will soon be explaining the concept on how the
space is divided and tree is formed.
For example for the next points:
We build the next tree:
4. EJERCICIOS
We will develop the search method in K-d Tree:
1. With the last k-d tree implemented in javascript, complete the closest_point_brute_force and
naive_closest_point functions.
k = 2;
class Node{
constructor(point, axis){
this.point = point;
this.left = null;
this.right = null;
this.axis = axis;
}
}
2. Evaluate your results with this data and point (compare the results of the two functions
developed before):
var data = [
[40,70],
[70,130],
[90,40],
[110, 100],
[140,110],
[160, 100]
];
var point = [140,90];
3. Now, evaluate your results with this data and point (compare the results of the two functions
developed before):
var data = [
[40,70],
[70,130],
[90,40],
[110, 100],
[140,110],
[160, 100],
[150, 30]
];
var point = [140,90];
return best;
}
earest points
5. Develop a search function in order to get the n n
REFERENCIAS
Maneewongvatana, S., & Mount, D. M. (1999, December). It’s okay to be skinny, if your friends are fat. In
Center for Geometric Computing 4th Annual Workshop on Computational Geometry (Vol. 2, pp. 1-8).