I have trouble understanding the quadtree split operation. Say the maximum number of items a node can hold is 2; when we add a third element we create four sub-nodes. The question is, does the parent node keep its 2 items and the one who caused the overflow is inserted in a child-node or all three nodes are inserted in the sub-nodes?
Asked
Active
Viewed 952 times
1 Answers
0
All three nodes get inserted into a child node. Only the leaves node can hold some data in a tree.
This can make a difference with say, for example, kd-tree, where the space partition is more data oriented instead of fixed space partitioning, thus saving memory. On the other hand, fixed space partitions are easier to handle and can even be precomputed for even faster access.

sansuiso
- 9,259
- 1
- 40
- 58
-
Thanks! But what does the parent node hold if all three are inserted down the tree? – mrk Oct 25 '13 at 21:20
-
The parent node (as any intermediate node) holds the pointers (or equivalent) to its 4 children. You know you can access the data when a node as no more children. – sansuiso Oct 25 '13 at 21:28
-
In fact, the Wikipedia article on quadtrees has pseudocode that uses internal nodes for storage. Once a node overflows, the overflow-item is inserted in a subnode. – mrk Oct 25 '13 at 22:50
-
What happens if a have node that contains 2 big circles and I add a 3rd big one? The node splits into 4 children and all the now 3 circles can intersects the children, so they are all added to the each child. But each child has to split as they can hold only 2 circle and the cycle continue indefinitely. What's wrong with my understanding? – ColOfAbRiX Jul 09 '15 at 16:15