What’s a Quadtree?

Print anything with Printful



A quadtree is a tree structure used to organize files in a database, with each parent having four child nodes. It can also be used to find pixels in 2D images. There are two main types: region and point trees. The region tree is best for images or data field graphs, while the point tree is best for ordered dots. Quadtrees are commonly used to separate and organize databases and for pixel hunting in images.

A quadtree is a tree structure based on powers of four used to organize files in a database. Each parent or starting node has four child nodes and each child contains a certain amount of data. When the data boundary extends beyond its boundary, four children will be created from that node. There are two main quadtree structures: the region and the point tree, each slightly different in design. While a quadtree is most often used with databases, it can also be used to find pixels in two-dimensional (2D) images, since pixels in a 2D image can always be separated into four parts.

All tree structures are made up of parent, or branch, and child, or leaf nodes. The parent is the starting point and contains broad category-based data, while the child contains files and documents. In a quadtree, each parent must have four children. Although there must be four children, not all children need to contain data; those without are known as null nodes. These null nodes often sit around and wait for data.

Each child node in a quadtree has a data limit. This limit is usually defined by the overall size of the database. When there is so much information that it pushes over the edge, the child node becomes a parent node essentially giving birth, creating four child nodes that take up all the extra data. Usually there will be one or two null nodes from this creation, but this depends entirely on how much data is in the node.

There are two main quadtrees: region and point. The region quadtree is used to decompose an entire 2D region into parts based on the power of four, such as four, eight, or 16 parts, and is often used for representations. This structure is best for images or data field graphs. The dot version is like a binary tree and is best used with ordered dots. This variant is also a real tree, because there is a central point from which all the nodes spring, unlike the region version where the nodes are scattered.

The most common use of the quadtree is to separate and organize a database, but that’s not its only use. Algorithms built to find a specific pixel in an image commonly use quadtrees, because each pixel in an image can be separated into four equal parts. This makes quadtrees particularly suitable for pixel hunting.




Protect your devices with Threat Protection by NordVPN


Skip to content