-1

I'm trying to implement kd-tree but I have problem with one operation - balancing. Is any existing way to balance kd-tree? For example: after inserting new element I'd like to have still balanced tree

Has QUIT--Anony-Mousse
  • 76,138
  • 12
  • 138
  • 194

2 Answers2

0

The usual approach seems to be to collect new elements in a list, and every now and then rebuild the tree with all changes completely.

Fully rebalancing an k-d-tree is clearly infeasible. There probably are some tradeoff solutions.

But usually, if you want a balanced tree, you would go with an R*-tree instead.

Has QUIT--Anony-Mousse
  • 76,138
  • 12
  • 138
  • 194
0

After some insert and delete, you need rebuild the KD-tree, this is the usual way to make it balanced.

The completely balanced KD-tree is almost imposible. Or maybe you can try KDB-tree.

Zhao Yuhao
  • 11
  • 1