itsme86, you ROCK!!!
thanks for your help! This is what I want!
But is it possible that there is character that need 8 bits to represent it?
Another question, since I can use 7 bits to represent a character and 1 bit to represent a flag. How do I use 30 bits to represent a pointer (that is, the 30 bits is use to represent an address that the pointer to), and 2 bits as flag?
I am reading a program source code which is doing this, but contain alot of files and its coding is too hard for me to comprehend. Here is a comment from the source code
Code:
/*
The most significant bits in the entries of table \texttt{streetab}
are used as marking bits. For each branching node we need 3 marking bits, and
for each leaf we need 2 marking bits. For each leaf and each
branching node we store 2 marking bits in their first integer: The
\emph{leaf-bit} and the \emph{rightmost-child} bit. For
each branching node we store 1 marking bit in the second integer,
the \emph{unevaluated} bit.
*/
/*
As a consequence, we have 30 bits to store
\(\mathit{left}(\overline{u})\) or \(\mathit{lp}(\overline{u})\)
for a branching node or leaf \(\overline{u}\).
Moreover, we have 31 bits to store \(\mathit{right}(\overline{u})\) or
\(\mathit{firstchild}(\overline{u})\) for a branching node \(\overline{u}\).
\(\mathit{left}(\overline{u})\),
\(\mathit{right}(\overline{u})\), and
\(\mathit{lp}(\overline{u})\) are in the range \([0,n]\).
\(\mathit{firstchild}(\overline{u})\) is in the range \([0,3n]\). Hence
\(3n\leq 2^{31}-1\) must be satisfied, i.e.\
the maximal length of the input string is \(715{,}827{,}882\).
*/
It talks about the data structure of a suffix tree, where a branching node got 2 integers. The first integer is a pointer to the string, second integer is a pointer to a leaf node. But the first integer use 30 bits to store address, second integer use 31 bits to store address.