




Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!





Jared Saia University of New Mexico
Table-Insert(T,x){ if (T.size == 0){allocate T with 1 slot;T.size=1} if (T.num == T.size){ allocate newTable with 2T.size slots; insert all items in T.table into newTable; T.table = newTable; T.size = 2T.size } T.table[T.num] = x; T.num++ }
Recall that ai = ci + Φi − Φi− 1
We want to preserve two properties:
Φ(t) =
{ 2 ∗ T.num − T.size if α(T ) ≥ 1 / 2 T.size/ 2 − T.num if α(T ) < 1 / 2
}
ai = ci + Φi − Φi− 1 (1) = 1 + (sizei/ 2 − numi) − (sizei− 1 / 2 − numi− 1 ) (2) = 1 + (sizei/ 2 − numi) − (sizei/ 2 − (numi − 1)) (3) = 0 (4)
ai = ci + Φi − Φi− 1 (5) = 1 + (2 ∗ numi − sizei) − (sizei− 1 / 2 − numi− 1 ) (6) = 1 + (2 ∗ (numi− 1 + 1) − sizei− 1 ) − (sizei− 1 / 2 − numi− 1 (7)) = 3 ∗ numi− 1 −
sizei− 1 + 3 (8)
= 3 ∗ αi− 1 ∗ sizei− 1 −
sizei− 1 + 3 (9)
<
∗ sizei− 1 −
sizei− 1 + 3 (10) = 3 (11)
We want to support the following operations: