Presentation is loading. Please wait.

Presentation is loading. Please wait.

PR Quadtree Geographical Data Structure. Background The structure of a BST is determined by the order of the data Depending on the order we can get either.

Similar presentations


Presentation on theme: "PR Quadtree Geographical Data Structure. Background The structure of a BST is determined by the order of the data Depending on the order we can get either."— Presentation transcript:

1 PR Quadtree Geographical Data Structure

2 Background The structure of a BST is determined by the order of the data Depending on the order we can get either very balanced or very unbalanced trees. This is not a good way to build a tree A PR Quadtree is a way to handle particular data that can be mapped to a “world”

3 Quadtrees Quadtrees are a whole family of trees. They are all based on the use of recursive decomposition They can be differentiated by two ways:  The type of data they represent  The principle guiding the decomposition process  The resolution (variable or not)

4 PR Quadtree Data is stored in leaves only. Internal nodes have four pointers. Pointers are labeled as NW, NE, SE, SW If during insertion a leaf node is found and the coordinates of the leaf node’s data differ from the data that is trying to be insert, then a new internal node is created and both pieces of data are inserted

5 Node Considerations This is a natural case where internal nodes and leaf nodes are different. A natural choice here would be to use inheritance. However most of the functions would be very different; so polymorphism might not really be all that helpful If you use inheritance about the only common method might be isLeaf() You will then have to cast the node as either an internal or leaf node

6 Insertion As you build a PR Quadtree, you will need to create both internal and leaf nodes The process is recursive You could put an insert method in the node class. What would happen here is a little different from how you may have done insertion in the past

7 Node’s handling Insertion You could polymorphically call insertion on a node and it would “know” which insertion to call The internal node would ask the data its coordinates and determine where it goes. In order to do this, the method needs to know some additional information It needs to know the corner of the world and the width of the world.

8 Leaf Insertion The leaf node insertion would have to do some more work First it would need to check to make sure that the data that is trying to be inserted isn’t already in the tree If not, then it needs to create a new internal node Then ask the new node to insert both the data that is already in the tree and the data that is trying to be inserted


Download ppt "PR Quadtree Geographical Data Structure. Background The structure of a BST is determined by the order of the data Depending on the order we can get either."

Similar presentations


Ads by Google