11.07.2015 Views

Data Structures and Algorithm Analysis - Computer Science at ...

Data Structures and Algorithm Analysis - Computer Science at ...

Data Structures and Algorithm Analysis - Computer Science at ...

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

448 Chap. 13 Advanced Tree <strong>Structures</strong>00127BACDnwne swseAB(40,45)(15,70)C D(70, 10) (69,50)E F (b)127(a)EF(55,80)(80, 90)Figure 13.16 Example of a PR quadtree. (a) A map of d<strong>at</strong>a points. We definethe region to be square with origin <strong>at</strong> the upper-left-h<strong>and</strong> corner <strong>and</strong> sides oflength 128. (b) The PR quadtree for the points in (a). (a) also shows the blockdecomposition imposed by the PR quadtree for this region.it is represented by a PR quadtree consisting of a single leaf node. If the region containsmore than a single d<strong>at</strong>a point, then the region is split into four equal quadrants.The corresponding PR quadtree then contains an internal node <strong>and</strong> four subtrees,each subtree representing a single quadrant of the region, which might in turn besplit into subquadrants. Each internal node of a PR quadtree represents a singlesplit of the two-dimensional region. The four quadrants of the region (or equivalently,the corresponding subtrees) are design<strong>at</strong>ed (in order) NW, NE, SW, <strong>and</strong> SE.Each quadrant containing more than a single point would in turn be recursively dividedinto subquadrants until each leaf of the corresponding PR quadtree contains<strong>at</strong> most one point.For example, consider the region of Figure 13.16(a) <strong>and</strong> the correspondingPR quadtree in Figure 13.16(b). The decomposition process dem<strong>and</strong>s a fixed keyrange. In this example, the region is assumed to be of size 128 × 128. Note th<strong>at</strong> theinternal nodes of the PR quadtree are used solely to indic<strong>at</strong>e decomposition of theregion; internal nodes do not store d<strong>at</strong>a records. Because the decomposition linesare predetermined (i.e, key-space decomposition is used), the PR quadtree is a trie.Search for a record m<strong>at</strong>ching point Q in the PR quadtree is straightforward.Beginning <strong>at</strong> the root, we continuously branch to the quadrant th<strong>at</strong> contains Q untilour search reaches a leaf node. If the root is a leaf, then just check to see if thenode’s d<strong>at</strong>a record m<strong>at</strong>ches point Q. If the root is an internal node, proceed tothe child th<strong>at</strong> contains the search coordin<strong>at</strong>e. For example, the NW quadrant ofFigure 13.16 contains points whose x <strong>and</strong> y values each fall in the range 0 to 63.The NE quadrant contains points whose x value falls in the range 64 to 127, <strong>and</strong>

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!