1. A method for encoding a sequence into a concatenated string, comprising: building a suffix tree of the sequence in reverse order; pruning the suffix tree to form a generalized context tree (GCT) having a plurality of states; obtaining a binary representation of a full tree derived from the GCT; encoding the sequence into a binary string using a dynamic tree model based on statistics collected at the plurality of states of the GCT; and concatenating the binary representation of the full tree with the binary string to form the concatenated string.