- Trending Categories
- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies

- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who

# Point Quadtrees in Data Structure

The point quadtree is an adaptation of a binary tree implemented to represent 2-dimensional point data. Features of all quadtrees is shared by point quadtree.

It is often very efficient in comparing 2-dimensional, ordered data points, usually executing in O(log n) time. Point quadtrees are valuable mentioning for completeness, but k-d trees surpass them as tools for generalized binary search.

Point quadtrees are built as follows.

Given the next point to insert, we compute the cell in which it lies and add it to the tree.

The new point is added such that the cell that contains it is divided into quadrants by the vertical and horizontal lines that run through the point. Consequently, cells are rectangular but not necessarily square.

In these trees, each node consists of one of the input points.

Since the division of the plane is determined by the order of point-insertion, the tree's height is sensitive to and dependent on insertion order. Inserting in an incorrect order can lead to a tree of height linear in the number of input points (at which point it becomes a linked-list).

If the point-set is static, pre-processing can be performed to build a tree of balanced height.

## Node structure for a point quadtree

A node of a point quadtree is same to a node of a binary tree, with the major difference being that it is associated with four pointers (each pointer is used for each quadrant) instead of two ("left" and "right") as in an ordinary binary tree. Also a key is usually broken into two parts, referring to x and y coordinates.

Therefore, a node consists of the following information

- four pointers: These are quad[‘NW’], quad[‘NE’], quad[‘SW’], and quad[‘SE’]
- NW-North West, NE-North East, SW-South West, SE-South East
- point; which in turn consists of
- key; usually denoted as x, y coordinates
- value; such as a name

- Related Articles
- Quadtrees in Data Structure
- Region Quadtrees in Data Structure
- Compressed Quadtrees and Octrees in Data Structure
- Rectangle Data in Data Structure
- Deaps in Data Structure
- Halfedge data structure
- Boole’s Inequality in Data Structure
- Bayes’ Rule in Data Structure
- Dictionary Operations in Data Structure
- Huffman Trees in Data Structure
- Arrays Data Structure in Javascript
- Stack Data Structure in Javascript
- Queue Data Structure in Javascript
- Set Data Structure in Javascript
- Dictionary Data Structure in Javascript