Skip to content

Commit

Permalink
Update 17.4.md
Browse files Browse the repository at this point in the history
  • Loading branch information
buscasangre authored and walkccc committed Apr 4, 2019
1 parent cbf1961 commit 0a5daa0
Showing 1 changed file with 21 additions and 7 deletions.
28 changes: 21 additions & 7 deletions docs/Chap17/17.4.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,27 @@ By theorems 11.6-11.8, the expected cost of performing insertions and searches i

> Show that if $\alpha_{i - 1} \ge 1 / 2$ and the $i$th operation on a dynamic table is $\text{TABLE-DELETE}$, then the amortized cost of the operation with respect to the potential function $\text{(17.6)}$ is bounded above by a constant.
$$
\begin{aligned}
\hat c_i & = c_i + \Phi_i - \Phi_{i - 1} \\\\
& = 1 + (2 \cdot num_i - size_i) - (2 \cdot (num_i + 1) - size_i) \\\\
& = -1.
\end{aligned}
$$
- **Case 1:** When $\alpha_i \ge 1 / 2$

$$
\begin{aligned}
\hat c_i & = c_i + \Phi_i - \Phi_{i - 1} \\\\
& = 1 + (2 \cdot num_i - size_i) - (2 \cdot (num_i + 1) - size_i) \\\\
& = -1.
\end{aligned}
$$

- **Case 2:** When $\alpha_i < 1 / 2$ and $\alpha_i \ge 1 / 4$

$$
\begin{aligned}
\hat c_i & = c_i + \Phi_i - \Phi_{i - 1} \\\\
& = 1 + (\frac{1}{2} size_i - num_i) - (2 \cdot (num_i + 1) - size_i) \\\\
& = -1 + (\frac{3}{2} size_i - 3 \cdot num_i) \\\\
& = -1 + 3 \quad \text{(since } size_i - 1 = 2 \cdot num_i - 1) \\\\
& = 2.
\end{aligned}
$$

## 17.4-3

Expand Down

0 comments on commit 0a5daa0

Please sign in to comment.