Professional Documents
Culture Documents
Priority Search Trees: Keys Are Pairs - Basic (Search, Insert, Delete) and Rectangle Operations. Two Varieties
Priority Search Trees: Keys Are Pairs - Basic (Search, Insert, Delete) and Rectangle Operations. Two Varieties
Keys are pairs (x,y). Basic (search, insert, delete) and rectangle operations. Two varieties.
Based on a balanced binary search tree such as a red-black tree.
Red-black Priority Search Tree (RBPST)
Insert
Start with empty RPST. k = 16. Root interval is [0,16). Insert (5,8).
[0,16)
5,8
[0,16) Insert (6,9). 5,8 (5,8) remains in root, because 8 < 9. (6,9) inserted in left subtree, because[0,8) 6 is in the left child interval. 6,9
Insert
[0,16)
5,8 Insert (7,1). (7,1) goes into the root, because 1 < 8. [0,8) (5,8) inserted in left subtree, because 5 6,9 [0,16) is in the left child interval. 7,1 (5,8) displaces (6,9), because 8 < 9.
Insert
[0,16) 7,1 [0,8) 5,8 [4,8) 6,9 [0,8) 5,8 [4,8) 6,9 [0,16) 7,1 [8,16) 11,5
Insert (11,5).
Properties
[0,16)
7,1
[0,8) 5,8 [0,4) 2,12 [4,8) 6,9 [8,16) 11,5
Search
[0,16)
7,1
[0,8) 5,8 [0,4) 2,12 [4,8) 6,9 [8,16) 11,5
Delete
[0,16)
7,1
[0,8) 5,8 [0,4) 2,12 [4,8) 6,9 [8,16) 11,5
minXinRectangle(xL,xR,yT)
[0,16)
12,1
[0,8) 5,8 [0,4) 2,12 [4,8) 6,9 [8,16) 11,5 [12,16) 14,6
Complexity
yok yok yok ynotOK ynotOK yok yok
yok
ynotOK Profile of visited nodes.
ynotOK
yok
ynotOK ynotOK
Complexity
yok yok yok ynotOK ynotOK yok yok
yok
ynotOK
ynotOK
yok
ynotOK ynotOK
Complexity
yok yok yok ynotOK ynotOK yok yok
yok
ynotOK
ynotOK
yok
ynotOK ynotOK
Complexity
yok yok yok ynotOK ynotOK yok yok
yok
ynotOK
ynotOK
yok
ynotOK ynotOK
No node in the yellow nodes subtree can have two children marked yok.
Complexity
yok yok yok ynotOK ynotOK yok yok
yok
ynotOK
ynotOK
yok
ynotOK ynotOK
maxXinRectangle(xL,xR,yT)
[0,16)
12,1
[0,8) 5,8 [0,4) 2,12 [4,8) 6,9 [8,16) 11,5 [12,16) 14,6
minYinXrange(xL,xR)
[0,16)
12,1
[0,8) 5,8 [0,4) 2,12 [4,8) 6,9 [8,16) 11,5 [12,16) 14,6
enumerateRectangle(xL,xR,yT)
[0,16)
12,1
[0,8) 5,8 [0,4) 2,12 [4,8) 6,9 [8,16) 11,5 [12,16) 14,6