Priority Search Trees Radix Priority Search Trees - PowerPoint PPT Presentation

1 / 16
About This Presentation
Title:

Priority Search Trees Radix Priority Search Trees

Description:

Radix Priority Search Trees. EDWARD M. McCREIGHT. Fang-chen, Kuo ... Radix priority search tree ... Radix priority search trees. Cartesian tree's problem ... – PowerPoint PPT presentation

Number of Views:911
Avg rating:3.0/5.0
Slides: 17
Provided by: cialCsie
Category:
Tags: priority | radix | search | trees

less

Transcript and Presenter's Notes

Title: Priority Search Trees Radix Priority Search Trees


1
Priority Search Trees Radix Priority Search
Trees
  • EDWARD M. McCREIGHT

Society for Industrial and Applied Mathematics
Vol. 14, No. 2, May 1985
Fang-chen, Kuo
2
Operation
  • Let D be a dynamic set of ordered pairs x,y
    over the set 0, 1, ,k-1 of integers. Consider
    the following operations applied to D
  • Insert (delete) a pair x,y into (from) D.
  • Given test integers x0, x1, and y1, among all
    pairs x,y in D such that x0xx1 and yy1, find
    a pair whose x is minimal (or maximal)
  • (3)Given test integers x0 and x1, among all pairs
    x,y in D Such that x0xx1, find a pair whose y
    is minimal

3
Operation
(4) Given test integers x0, x1, and y1, enumerate
those pairs x,y in D such that x0xx1 and yy1
Use the structure called priority search trees
,of which two variants are introduced, operations
(1),(2),(3) can be done in O(log n) time, and (4)
Can be done in O(log n s) time n is the
cardinality of D, and s is the number of pairs
enumerated.
4
An example
5
Radix priority search tree
  • The data has two independent dimensions, but the
    priority search tree does not allow equally
    powerful searching operations on both.
  • There is a major dimension(x) permitting
    arbitrary range queries, and a minor one (y)
    permitting only enumeration in increasing order.
  • All the search rectangles have only three sides
    free the fourth side is anchored at y00.

6
Radix priority search trees Data structure
  • We assume that the set D of pairs contains no
    duplicate x values.
  • The first invariant is a priority queue invariant
    on y-values.
  • It asserts that for any node t in a radix
    priority search tree, if t.left is not NIL then
    t.p.yt.left?.p.y, and if t.right is not NIL then
    t.p.yt.right?.p.y.
  • This first invariant constrains only direct
    ancestor-descendant relations it does not
    constrain sibling relations at all.

7
Radix priority search trees
  • The second invariant is a radix search tree
    invariant on x-values.
  • It asserts that associated with each node t in a
    radix priority search tree is an x-interval
    lower..upper) within which t.p.x lies.
  • For any node t such that t.left is not NIL, the
    x-interval associated with the node t.left ? is
    lower..floor((lowerupper)/2)).
  • For any node t such that t.right is not NIL, the
    x-interval associated with the node t.right? is
    floor((lowerupper)/2)..upper).

8
Radix priority search trees Related Works
1.Select the pair x,y with minimum y
2.Divide the region with a line of constant x
3.Recursively represent the remaining points in
the two subregions in the two subtrees of the
root in the same manner.
If the line in (2) is xx, then the data
structure is called Cartesian tree
9
Radix priority search trees Cartesian trees
problem
The structure allow very good performance in the
average case, but its performance in the worst
case is no better than a linear list
10
Radix priority search trees
1.(1) becomes root because of its minimal y vaue.
2.Divide the x-interval use bisection.
3.All the pair in the left-side of the line in 2,
belong the left-subtree of (1)
6
5
4.All the pair in the right-side of the line in
2, belong the right-subtree of (1)
3
2
4
5.Find the root for the left and right subtrees
1
6.Recusive to build the tree.
11
Radix priority search trees(InsertPair)
1.Insert Blue point
2.Blues y value is bigger than (1)s y value,
and blues x value is in the left-half-side of
the x interval, so we insert blue into (1)s
left-subtree.
4
2
3.Because of blues y value is small enough to
beat (2), so we let blue replace to place of (2),
3
4.Now we have to insert (2) in blues left
sub-tree
1
5.After insert (2) in blues left-sub-tree
12
Radix priority search trees(DeletePair)
1.If we want to delete (8), because (8) has no
child, so we can just delete it.
2.If we want to delete (2), but we cant just do
that for that we have to keeping the data
structure working, so we have to pick some pair
to instead the (2) 3.In this case, we pick (4) as
the new root.(Because (4)s y value is smaller
than (3)s y value)
8
3
6
4
7
4.If we want to delete (1), as the same way, we
let (5) to replace (1), then there comes the same
problem, we just use (7) to instead (5)
2
5
1
13
Radix priority search trees(MinXInRectangle)
1.If t.p.y lies above the top of the constraint
rectangle, then because a priority search tree is
a priority queue in y, no pair in the subtree
rooted at t lies within the constraint rectangle
2.If no pair in the left subtree lies within the
constraint rectangle, then (and only then) the
solution might be found in the right subtree.
14
Radix priority search trees(MaxXInRectangle)
  • Like MinXInRectangle.

15
Radix priority search trees(MinYInRange)
1. If t.p lies within the constraint x-interval,
then because a priority search tree is a priority
queue in y, t.p is the correct solution
2.Otherwise, the solution, if it exists, is the
better of the solutions of two subtrees.
16
Radix priority search trees(EnumerateRectangle)
EnumerateRectangle is a depth-first enumeration
that calls the function Report whenever a pair is
found within the constraint rectangle. Report
returns TRUE if the enumeration should continue,
and FALSE if it should terminate.
Write a Comment
User Comments (0)
About PowerShow.com