In computer science, a succinct data structure is a data structure which uses an amount of space that is "close" to the information-theoretic lower bound, but (unlike other compressed representations) still allows for efficient query operations. The concept was originally introduced by Jacobson to encode bit vectors, (unlabeled) trees, and planar graphs. Unlike general lossless data compression algorithms, succinct data structures retain the ability to use them in-place, without decompressing them first. A related notion is that of a compressed data structure, insofar as the size of the stored or encoded data similarly depends upon the specific content of the data itself. Suppose that Z is the information-theoretical optimal number of bits needed to store some data. A representation of this data is called:
implicit if it takes Z+O(1) bits of space, succinct if it takes Z+o(Z) bits of space, and compact if it takes O(Z) bits of space. For example, a data structure that uses 2Z bits of storage is compact, Z+Z bits is succinct, Z+lgZ bits is also succinct, and Z+3 bits is implicit. Implicit structures are thus usually reduced to storing information using some permutation of the input data; the most well-known example of this is the heap.
Succinct indexable dictionaries Succinct indexable dictionaries, also called rank/select dictionaries, form the basis of a number of succinct representation techniques, including binary trees, k-ary trees and multisets, as well as suffix trees and arrays. The basic problem is to store a subset S of a universe U=[0…n)={0,1,…,n−1}, usually represented as a bit array B[0…n) where B[i]=1 iff i∈S. An indexable dictionary supports the usual methods on dictionaries (queries, and insertions/deletions in the dynamic case) as well as the following operations:
𝐫𝐚𝐧𝐤q(x)=|{k∈[0…x]:B[k]=q}| 𝐬𝐞𝐥𝐞𝐜𝐭q(x)=min{k∈[0…n):𝐫𝐚𝐧𝐤q(k)=x} for q∈{0,1}. In other words, 𝐫𝐚𝐧𝐤q(x) returns the number of elements equal to q up to position x while 𝐬𝐞𝐥𝐞𝐜𝐭q(x) returns the position of the x-th occurrence of q. There is a simple representation which uses n+o(n) bits of storage space (the original bit array and an o(n) auxiliary structure) and supports rank and select in constant time. It uses an idea similar to that for range-minimum queries; there are a constant number of recursions before stopping at a subproblem of a limited size. The bit array B is partitioned into large blocks of size l=lg2n bits and small blocks of size s=lgn/2 bits. For each large block, the rank of its first bit is stored in a separate table Rl[0…n/l); each such entry takes lgn bits for a total of (n/l)lgn=n/lgn bits of storage. Within a large block, another directory Rs[0…l/s) stores the rank of each of the l/s=2lgn small blocks it contains. The difference here is that it only needs lgl=lglg2n=2lglgn bits for each entry, since only the differences from the rank of the first bit in the containing large block need to be stored. Thus, this table takes a total of (n/s)lgl=4nlglgn/lgn bits. A lookup table Rp can then be used that stores the answer to every possible rank query on a bit string of length s for i∈[0,s); this requires 2sslgs=O(nlgnlglgn) bits of storage space. Thus, since each of these auxiliary tables take o(n) space, this data structure supports rank queries in O(1) time and n+o(n) bits of space. To answer a query for 𝐫𝐚𝐧𝐤1(x) in constant time, a constant time algorithm computes:
𝐫𝐚𝐧𝐤1(x)=Rl[⌊x/l⌋]+Rs[⌊x/s⌋]+Rp[x⌊x/s⌋,x mod s] In practice, the lookup table Rp can be replaced by bitwise operations and smaller tables that can be used to find the number of bits set in the small blocks. This is often beneficial, since succinct data structures find their uses in large data sets, in which case cache misses become much more frequent and the chances of the lookup table being evicted from closer CPU caches becomes higher. Select queries can be easily supported by doing a binary search on the same auxiliary structure used for rank; however, this takes O(lgn) time in the worst case. A more complicated structure using 3n/lglgn+O(nlgnlglgn)=o(n) bits of additional storage can be used to support select in constant time. In practice, many of these solutions have hidden constants in the O(⋅) notation which dominate before any asymptotic advantage becomes apparent; implementations using broadword operations and word-aligned blocks often perform better in practice.
Entropy-compressed solutions The n+o(n) space approach can be improved by noting that there are (nm) distinct m-subsets of [n) (or binary strings of length n with exactly m 1’s), and thus ℬ(m,n)=⌈lg(nm)⌉ is an information theoretic lower bound on the number of bits needed to store B. There is a succinct (static) dictionary which attains this bound, namely using ℬ(m,n)+o(ℬ(m,n)) space. This structure can be extended to support rank and select queries and takes ℬ(m,n)+O(m+nlglgn/lgn) space. Correct rank queries in this structure are however limited to elements contained in the set, analogous to how minimal perfect hashing functions work. This bound can be reduced to a space/time tradeoff by reducing the storage space of the dictionary to ℬ(m,n)+O(ntt/lgtn+n3/4) with queries taking O(t) time. If one wishes to support insertions and deletions, it is possible to achieve a space bound of ℬ(m,n)+O(n/2(logn)Ω(1)) while supporting each operation (insertion, deletion, rank, or select) in expected time O(1+logn/loglogm). It is also possible to construct a indexible dictionary supporting rank (but not select) that uses fewer than ℬ(m,n) bits, so long as rank queries are limited to elements contained in the set. Such a dictionary is called a monotone minimal perfect hash function, and can be implemented using as few as O(mlogloglogn) bits.
… excerpt ends here. Continue reading the full article.