Quadtree

Quadtree
TypeTree
Invented1974
Invented byRaphael Finkel and J.L. Bentley
Time complexity in big O notation
Operation Average Worst case
Space complexity
A point-region quadtree with point data. Bucket capacity 1.
Quadtree compression of an image step by step. Left shows the compressed image with the tree bounding boxes while the right shows just the compressed image

A quadtree is a tree data structure in which each internal node has exactly four children. Quadtrees are the two-dimensional analog of octrees and are most often used to partition a two-dimensional space by recursively subdividing it into four quadrants or regions. The data associated with a leaf cell varies by application, but the leaf cell represents a "unit of interesting spatial information".

The subdivided regions may be square or rectangular, or may have arbitrary shapes. This data structure was named a quadtree by Raphael Finkel and J.L. Bentley in 1974.[1] A similar partitioning is also known as a Q-tree.

All forms of quadtrees share some common features:

  • They decompose space into adaptable cells.
  • Each cell (or bucket) has a maximum capacity. When maximum capacity is reached, the bucket splits.
  • The tree directory follows the spatial decomposition of the quadtree.

A tree-pyramid (T-pyramid) is a "complete" tree; every node of the T-pyramid has four child nodes except leaf nodes; all leaves are on the same level, the level that corresponds to individual pixels in the image. The data in a tree-pyramid can be stored compactly in an array as an implicit data structure similar to the way a complete binary tree can be stored compactly in an array.[2]

  1. ^ Finkel, R. A.; Bentley, J. L. (1974). "Quad trees a data structure for retrieval on composite keys". Acta Informatica. 4 (1): 1–9. doi:10.1007/BF00288933. S2CID 33019699. Retrieved 6 November 2019.
  2. ^ Milan Sonka, Vaclav Hlavac, Roger Boyle. "Image Processing, Analysis, and Machine Vision". 2014. p. 108-109.