Docsity

Radix Priority Search Trees: RPST and RBPST, Slides of Computer Science

Toggle sidebar
bg1
Priority Search Trees
• Keys are distinct ordered pairs (xi, yi).
• Min tree on y.
• Search tree (almost) on x.
• Two varieties.
Search tree is a balanced binary search tree such as
a red-black tree.
• Red-black Priority Search Tree (RBPST)
Search tree is a radix search tree.
• Radix Priority Search Tree (RPST)
Radix Priority Search Tree
• All x values are different, integral, and in the
range [0, k – 1].
• Each node of the priority search tree has exactly
one element.
• The y value of the element in node w is <= the y
value of all elements in the subtree rooted at w
(y values define a min tree).
• Root interval is [0,k).
• Interval for node w is [a,b).
Left child interval is [a, floor((a+b)/2)).
Right child interval is [floor((a+b)/2, b)).
Docsity.com
pf3
pf4
pf5
pf8
pf9

Partial preview of the text

Download Radix Priority Search Trees: RPST and RBPST and more Slides Computer Science in PDF only on Docsity!

Priority Search Trees

  • Keys are distinct ordered pairs (x• Min tree on y. i, yi).
  • Search tree (almost) on x.• Two varieties.  Search tree is a balanced binary search tree such asa red-black tree.  Search tree is a radix search tree.^ • Red-black Priority Search Tree (RBPST) - Radix Priority Search Tree (RPST)

Radix Priority Search Tree

  • All x values are different, integral, and in therange [0, k – 1].
  • Each node of the priority search tree has exactlyone element.
  • The y value of the element in node w is <= the yvalue of all elements in the subtree rooted at w
  • Root interval is [0,k).(y values define a min tree).
  • Interval for node w is [a,b).  Left child interval is [a, floor((a+b)/2)).  Right child interval is [floor((a+b)/2, b)).

Insert

  • Start with empty RPST.• k = 16.
  • Root interval is [0,16).• Insert (5,8).
  • Insert (6,9).• (5,8) remains in root, because 8 < 9.
  • (6,9) inserted in left subtree, because6 is in the left child interval.

[0,16)

[0,16)

[0,8)

Insert

  • Insert (7,1).• (7,1) goes into the root, because 1 < 8.^ 5, 6,

[0,16)

[0,8)

[0,16) 7,

[0,8)

[4,8) 6,

  • (5,8) inserted in left subtree, because 5is in the left child interval.
  • (5,8) displaces (6,9), because 8 < 9.
  • (6,9) inserted in right subtree, because6 is in the right child interval.

Search

  • Search time is O(log k).

[0,16) 7,

[0,8)

[4,8) 6,

[8,16)

[0,4) 2,

Delete

  • Similar to delete min of min heap.• Delete time is O(log k).

[0,16) 7,

[0,8)

[4,8) 6,

[8,16)

[0,4) 2,

minXinRectangle(xL,xR,yT)

  • minXinRectangle(6,12,7).• Time is O(log k).

[0,16) 12,

[0,8)

[4,8) 6,

[8,16)

[0,4) 2,

[12,16)

Complexity

Profile of visited nodes.

yok yok

yok

yok

ynotOK

ynotOK ynotOK

yok

yok

ynotOK

ynotOK ynotOK

yok

Complexity

No node in the yellow node’s subtree can have twochildren marked yok.

yok^ yok

yok

yok

ynotOK

ynotOK ynotOK

yok

yok

ynotOK

ynotOK ynotOK

yok

Complexity

yok^ yok

yok

yok

ynotOK

ynotOK ynotOK

yok

yok

ynotOK

ynotOK ynotOK

yok

# nodes < 4log k.

maxXinRectangle(xL,xR,yT)

  • maxXinRectangle(6,12,7).• Time is O(log k).

[0,16) 12,

[0,8)

[4,8) 6,

[8,16)

[0,4) 2,

[12,16)

minYinXrange(xL,xR)

  • minYinXrange(6,10).• Time is O(log k).

[0,16) 12,

[0,8)

[4,8) 6,

[8,16)

[0,4) 2,

[12,16)