Skip to content
Snippets Groups Projects
Commit 3a9cc9de authored by Václav Končický's avatar Václav Končický
Browse files

Dynamization: Spellchecking and bibliography

parent b2eb347c
No related branches found
No related tags found
No related merge requests found
...@@ -8,3 +8,14 @@ ...@@ -8,3 +8,14 @@
isbn = "978-80-239-9049-2", isbn = "978-80-239-9049-2",
url = "http://mj.ucw.cz/vyuka/ga/" url = "http://mj.ucw.cz/vyuka/ga/"
} }
@book { km:dsa3,
author = "Kurt Mehlhorn",
title = "{Data Structures and Algorithms 3}",
series = "{EATCS Monographs on Theoretical Computer Science}",
volume = 3,
year = 1984,
publisher = "{Springer, Berlin, Heidelberg}",
isbn = "978-3-642-69900-9",
url = "http://people.mpi-inf.mpg.de/~mehlhorn/DatAlgbooks.html"
}
...@@ -92,7 +92,7 @@ $BB[\alpha]$ trees. ...@@ -92,7 +92,7 @@ $BB[\alpha]$ trees.
Rebuilding a subtree $T(v)$ takes $\O(s(v))$ time, but we can show that this Rebuilding a subtree $T(v)$ takes $\O(s(v))$ time, but we can show that this
happens infrequently enough. Both insertion and deletion change the amount of happens infrequently enough. Both insertion and deletion change the amount of
nodes by one. To inbalance a root of a perfectly balanced trees, and thus cause nodes by one. To unbalance a root of a perfectly balanced trees, and thus cause
a rebuild, we need to add or remove at least $\Theta(n)$ vertices. We will a rebuild, we need to add or remove at least $\Theta(n)$ vertices. We will
show this more in detail for insertion. show this more in detail for insertion.
...@@ -208,7 +208,7 @@ decomposable search problem $f$ and the resulting dynamic data structure $D$:} ...@@ -208,7 +208,7 @@ decomposable search problem $f$ and the resulting dynamic data structure $D$:}
\: $\bar I_D(n)$ is {\I amortized} time complexity of insertion to $D$. \: $\bar I_D(n)$ is {\I amortized} time complexity of insertion to $D$.
\endlist \endlist
We assume that $Q_S(n)$, $B_S(n)/n$, $S_S(n)/n$ are all nondecreasing functions. We assume that $Q_S(n)$, $B_S(n)/n$, $S_S(n)/n$ are all non-decreasing functions.
We decompose the set $X$ into blocks $B_i$ such that $|B_i| \in \{0, 2^i\}$ We decompose the set $X$ into blocks $B_i$ such that $|B_i| \in \{0, 2^i\}$
such that $\bigcup_i B_i = X$ and $B_i \cap B_j = \emptyset$ for all $i \neq such that $\bigcup_i B_i = X$ and $B_i \cap B_j = \emptyset$ for all $i \neq
...@@ -239,7 +239,7 @@ Now let us calculate the space complexity of $D$. ...@@ -239,7 +239,7 @@ Now let us calculate the space complexity of $D$.
For $|X| = n$ let $I = \{i \mid B_i \neq \emptyset\}$. Then for each $i \in I$ For $|X| = n$ let $I = \{i \mid B_i \neq \emptyset\}$. Then for each $i \in I$
we store a static data structure $S$ with $2^i$ elements contained in this we store a static data structure $S$ with $2^i$ elements contained in this
block. Therefore, $Q_D(n) = \sum_{i \in I} Q_S(2^i)$. Since $S_S(n)$ is block. Therefore, $Q_D(n) = \sum_{i \in I} Q_S(2^i)$. Since $S_S(n)$ is
assumed to be nondecreasing, assumed to be non-decreasing,
$$ $$
\sum_{i \in I} Q_S(2^i) \sum_{i \in I} Q_S(2^i)
\leq \sum_{i \in I} {Q_S(2^i) \over 2^i} \cdot 2^i \leq \sum_{i \in I} {Q_S(2^i) \over 2^i} \cdot 2^i
...@@ -249,7 +249,7 @@ $$ ...@@ -249,7 +249,7 @@ $$
\qed \qed
It might be advantageous to store the elements in each block separately so that It might be advantageous to store the elements in each block separately so that
we do not have to inspect the static structure and extrace the elements from we do not have to inspect the static structure and extract the elements from
it, which may take additional time. it, which may take additional time.
An insertion of $x$ will act like an addition of 1 to a binary number. Let $i$ An insertion of $x$ will act like an addition of 1 to a binary number. Let $i$
...@@ -265,7 +265,7 @@ TODO image ...@@ -265,7 +265,7 @@ TODO image
\proof{ \proof{
Since the last creation of $B_i$ there had to be least $2^i$ Since the last creation of $B_i$ there had to be least $2^i$
insertions. Amortized over one element this cost is $B_S(2^i) / 2^i$. insertions. Amortized over one element this cost is $B_S(2^i) / 2^i$.
As this function is nondecreasing, we can lower bound it by $B_S(n) / As this function is non-decreasing, we can lower bound it by $B_S(n) /
n$. However, one element can participate in $\log n$ rebuilds during n$. However, one element can participate in $\log n$ rebuilds during
the structure life. Therefore, each element needs to store up cost $\log n the structure life. Therefore, each element needs to store up cost $\log n
\cdot B_S(n) / n$ to pay off all rebuilds. \cdot B_S(n) / n$ to pay off all rebuilds.
...@@ -322,7 +322,7 @@ queries. No such block contains a duplicate element and union of all complete ...@@ -322,7 +322,7 @@ queries. No such block contains a duplicate element and union of all complete
blocks contains the whole set $X$. blocks contains the whole set $X$.
Next let $B_i^*$ be a block in construction. Whenever two blocks $B_i^a, B_i^b$ Next let $B_i^*$ be a block in construction. Whenever two blocks $B_i^a, B_i^b$
of same rank $i$ meet, we will immidiately start building $B_{i+1}^*$ using of same rank $i$ meet, we will immediately start building $B_{i+1}^*$ using
elements from $B_i^a \cup B_i^b$. elements from $B_i^a \cup B_i^b$.
This construction will require $2^{i+1}$ This construction will require $2^{i+1}$
...@@ -331,7 +331,7 @@ we finish $B_{i+1}^*$, we add it to the structure as one of the three full ...@@ -331,7 +331,7 @@ we finish $B_{i+1}^*$, we add it to the structure as one of the three full
blocks and finally remove $B_i^a$ and $B_i^b$. blocks and finally remove $B_i^a$ and $B_i^b$.
We will show that, using this scheme, this amount of blocks is enough to We will show that, using this scheme, this amount of blocks is enough to
bookkeep the structure. book-keep the structure.
\lemma{ \lemma{
At any point of the structure's life, for each rank $i$, there are at most At any point of the structure's life, for each rank $i$, there are at most
...@@ -353,7 +353,7 @@ together and no block of rank $i+1$ in construction. ...@@ -353,7 +353,7 @@ together and no block of rank $i+1$ in construction.
\qed \qed
An insertion is now done by simply creating new block $B_0$. Next, we An insertion is now done by simply creating new block $B_0$. Next, we
additionaly run one step of construction for each $B_j^*$. There may be up to additionally run one step of construction for each $B_j^*$. There may be up to
$\log n$ blocks in construction. $\log n$ blocks in construction.
\theorem{ \theorem{
...@@ -395,7 +395,7 @@ keep a pointer on its instance in the BST. When we build a new block, we can ...@@ -395,7 +395,7 @@ keep a pointer on its instance in the BST. When we build a new block, we can
update all its current elements in the tree in constant time (and insert the update all its current elements in the tree in constant time (and insert the
new one in logarithmic time). new one in logarithmic time).
Insertion time complexity then will always take at least logaritmic time and Insertion time complexity then will always take at least logarithmic time and
space requirements increase by the BST. space requirements increase by the BST.
Deletion then finds an element in the BST, locates it in the corresponding Deletion then finds an element in the BST, locates it in the corresponding
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment