algorithmsearchdata-structuresbinary-treekdtree

For range searching and nearest neighbor respectively in 2d area, which one of quad tree and kd tree is better?


Suppose all the data isn’t dynamic, for range searching and nearest neighbor respectively, which one of Kd tree and quad tree is often preferred?

The time complexity without rebalancing should be the same. Then What’s exact difference between the two data structures when performing searching operations?


Solution

  • You're asking two questions related to 2D static tree structures.

    1) What's the structure difference between the 2 trees.

    I think the main differences are as follows:

    2) Which tree is better (what's the performance difference between the 2 trees).

    This is difficult to answer, because realistically, this very much depends on the implementation quality or for which purpose they were implemented. As such, different implementations of just the same structure can already have large performance differences.

    Since you are interested in range and nearest neighbor searches, Wikipedia states that (point) QuadTrees have been surpassed by KdTrees.