From: Martin Mares Date: Wed, 5 Mar 2008 13:28:26 +0000 (+0100) Subject: Improved proof of QH lemma. X-Git-Tag: printed~192 X-Git-Url: http://mj.ucw.cz/gitweb/?a=commitdiff_plain;h=b91d05e5dc6c8822f9cf1e4029c05ff94ffcbc26;p=saga.git Improved proof of QH lemma. --- diff --git a/ram.tex b/ram.tex index 1f8705e..7cdf752 100644 --- a/ram.tex +++ b/ram.tex @@ -839,17 +839,19 @@ The rank $R_X(x)$ can be computed in constant time from: \endlist \proof -We know that the trie~$T$ is uniquely determined by the order of the $g_i$'s +Let us prove that all ingredients of Lemma~\ref{qhdeterm} are either small +enough or computable in constant time. + +We know that the shape of the trie~$T$ is uniquely determined by the order of the $g_i$'s and therefore by the function~$G$ since the array~$B$ is sorted. The shape of -the trie together with the bits in $x[B]$ determine the leaf $T[x]$ visited -when searching for~$x$. All this can be computed in polynomial time and it +the trie together with the bits in $x[B]$ determine the leaf~$x_i$ found when searching +for~$x$ using only the guides. This can be computed in polynomial time and it depends on $\O(k\log k)$ bits of input, so according to Lemma~\ref{qhprecomp} we can look it up in a~precomputed table. -Similarly we will determine all other ingredients of Lemma~\ref{qhdeterm} in -constant time. As we know~$x$ and all the $x_i$'s, we can immediately find -the relation between $x$ and $x_{T[x]}$ and use the LSB/MSB algorithm (\ref{lsb}) -to find the topmost disagreeing bit. +The relation between $x$ and~$x_i$ can be obtained directly as we know the~$x_i$. +The bit position of the first disagreement can be calculated in constant time +using the LSB/MSB algorithm (\ref{lsb}). All these ingredients can be stored in $\O(k\log k)$ bits, so we may assume that the rank can be looked up in constant time as well.