- Trending Categories
- Data Structure
- Operating System
- C Programming
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Quadtrees in Data Structure
Quadtrees are trees implemented to efficiently store data of points on a two-dimensional space. In this tree, each node has maximum four children.
We can build a quadtree from a two-dimensional area implementing the following steps
- The current two dimensional space is divided into four boxes.
- If a box consists of one or more points in it, build a child object, storing in it the two dimensional space of the box.
- If a box does not contain any points, do not build a child for it.
- Perform recursion for each of the children.
Quadtrees are implemented in image compression, where each node consists of the average colour of each of its children.
The deeper we visit in the tree, the more the detail of the image.
Quadtrees are also implemented in searching for nodes in a two-dimensional area. For instance, if we wanted to compute the closest point to given coordinates, we can do it implementing quadtrees.
The insert functions is implemented to insert a node into an existing Quad Tree. This function first verifies whether the given node is within the boundaries of the current quad. If it is not, then we immediately cancel the insertion. If it is within the boundaries, we choose the appropriate child to contain this node based on its location. This function is O(Log N) where N indicates the size of distance.
The search function is implemented to locate a node in the given quad. It can also be edited to return the closest node to the given point. This function is applied by taking the given point, comparing with the boundaries of the child quads and recursing. This function is O(Log N) where N indicates the size of distance.
Some common uses of quadtrees
- Image Representation of image
- Image Processing of image
- Mesh generation of mesh
- Performs efficient collision detection in two dimensions
- Performs to find solution of multidimensional fields (computational fluid dynamics, electromagnetism)
- Estimation of state
- Quadtrees are also implemented in the area of fractal image analysis
- Point Quadtrees in Data Structure
- Region Quadtrees in Data Structure
- Compressed Quadtrees and Octrees in Data Structure
- Rectangle Data in Data Structure
- Halfedge data structure
- Deaps in Data Structure
- Finger Searching in Data Structure
- Skip Lists in Data Structure