1 / 8

PR Quadtree

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 very balanced or very unbalanced trees. This is not a good way to build a tree

haig
Download Presentation

PR Quadtree

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

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

More Related