• Keine Ergebnisse gefunden

Addition and Deletion

N/A
N/A
Protected

Academic year: 2022

Aktie "Addition and Deletion"

Copied!
6
0
0

Wird geladen.... (Jetzt Volltext ansehen)

Volltext

(1)

4. Dynamic Setting

Addition and Deletion

M: the set of objects in the give time after a series of addition and deletion

Remark

• H(M) does no depend on the insertion order of M

• The history and the search structure depend on the insertion order General Idea

• For each object in M, we randomly choose a priority (a real number) from the uniform distribution on the interval (0,1).

• Shuffle (or a priority order) on M is the ordering of objects of M ac- cording to the increasing priorities

• Shuffle is exactly the insertion order

• Sk = kth object in the shuffle, and Mi = {S1, S2, . . . , Si}

• He(shuffle(Mi)) is the history of H(shuffle(M1)), H(shuffle(M2)), . . ., H(shuffle(Mi))

4. Random Binary Tree of Quick-Sort

M = S1 S2 S3 S4 S5 S6 S7 S8

Value 23 11 37 47 29 3 7 19

Priority 0.1 0.3 0.4 0.5 0.6 0.8 0.9 0.95

We want to delete S from M

(2)

Fact

If a point v is a descendent of a point u, u’s priority is lower than v’s Case 1: S is a leaf in the sense that its two sons are both intervals

• Combine its two sons into one interval

• replace S with I

S

I1 I2

I

Case 2: S is an internal node in the sense that at least one of its sons is a point

• Move S to become a leaf and delete it

– Increase S’s priority step by step to prepared S is inserted later

– When S’s priority is higher than one of its sons, a rotation will happen and move S downward one level

Rotation:

Assume S has two sons S0 and S00, S0 has low priority than S00 S

S0 S00

α β

γ

S S0

S00

α β

γ

(3)

Repeatedly performing rotations will bring S to the bottom such that we can delete it.

The expected number of rotations is at most the expected depths of the binary tree, which is O(logn)

Adding S

• use He(M) to locate S

• Split the interval contains S

• Assume S0 to be the original parent of the interval. Let S0 be the parent of S and S be the parent of the two new intervals

• Assign S a priority higher than S0

Another viewpoint of rotation:

Deleting S from shuffle(M) can be carried out by moving S higher one by one.

l is the number of points with priorities higher than S

M(i) is the priority-ordered set obtained from M by moving S higher in the order by i places.

shuffle(M(0)), shuffle(M(1)), . . ., shuffle(M(l)) B = M(i− 1) and C = M(i)

Let S0 be the point just after S in the priority order B

j = m − l+ i− 1, i.e., H(C) = H(Cj) and H(B) = H(Bj)

H(Bj−1) H(Bj) H(Bj+1) H(Bj+2)

H(Cj−1) H(Cj) H(Cj+1) H(Cj+2) S

S S0

S0

= = =

(4)

If H(B) = H(C), this operation is free.

• S and S0 is contained in different intervals of H(Bj−1)

S S2 S1 S0 S3 S4 S1

S2 S3

S4

S S2 S1 S0 S3 S4 S1

S2 S3

S4

S S2 S1 S0 S3 S4 S1

S2 S3

S4

S S2 S1 S0 S3 S4 S1

S2 S3

S4 S

S

H(B4) = H(C4)

H(B6) = H(C6)

H(B5) H(C5)

add S add S0

add S0 add S

(5)

If we give S a priority above that of S0, a right rotation can reflect the new shuffle on M

H(Bj−1)

H(Bj)

H(Bj+1)

S

S S0

α β γ

α

add S

add S0

H(Cj−1)

H(Cj)

H(Cj+1)

S

α β γ

add S0

add S

S0

β

S

S0

α

β γ

S0

α β

γ

S

(6)

4.2 Trapezoidal Decomposition

f S

S0

f1 S

S0

S

S0 f2

f3

g1 g2

g3

S0 h1

h2 h3

h4 h5

f

f1 f2

f3 = h5

h1 h2 h3 h4 g1 = h1 h2 h3 h4 h5 g2 g3

f

Referenzen

ÄHNLICHE DOKUMENTE

Für einen Beobachter ist die Geschwindigkeit eines Objektes, das sich in einem zum Beobachter bewegten Inertialsystem bewegt, kleiner als die Summe

This type of reaction may be useful for the marking of peptides at the

Successful peripheral regional anaesthesia in patients with 22q11.2 deletion syndrome has been published in literature and can be considered whenever feasible regarding patient

Discussion and conclusions: We describe a case of mosaic 13q deletion syndrome affected by retinoblastoma.. Molecular data obtained from the tumor analysis are similar to previous

[r]

[r]

Beim zweiten Bruch haben wir den Nenner mit 4 erweitert, also machen wir dies auch im

Ergänze die fehlenden Zahlen im Rechenprotokoll.. Lösung: