290 likes | 819 Views
k-d tree. k -dimensional indexing. Definition. Let k be a positive integer. Let t be a k -d tree, with a root node p . Then, for any node n in t : The key j , j+1 , …, j-1 of any node q in the left subtree of n is smaller than that of node p ,
E N D
k-d tree k-dimensional indexing
Definition • Let k be a positive integer. Let t be a k-d tree, with a root node p. Then, for any node n in t : • The key j,j+1, …, j-1 of any node q in the left subtree of n is smaller than that of node p, • The key j,j+1, …, j-1 of any node q in the right subtree of n is larger than that of node p. k-d trees
Example 20,31 15,15 36,10 6,6 31,40 25,16 40,36 k-d trees
Insertion 20,31 15,15 36,10 6,6 31,40 25,16 40,36 k-d trees
Exact Search 20,31 (40, 36) 15,15 36,10 6,6 31,40 25,16 40,36 k-d trees
Range search 20,31 15,15 36,10 6,6 31,40 25,16 40,36 k-d trees
Deletion 20,31 15,15 36,10 28,5 38,40 45,8 32,16 40,36 Delete the blue point Copy the pink point up k-d trees
Deletion 28,5 15,15 36,10 38,40 45,8 32,16 40,36 Delete the old pink point k-d trees