Substring
A substring is a string contained entirely within another string. For example, "top" is a substring of "Discretopia".
Prefixes and suffixes are special cases of substrings that occur at the beginning of a string and end of a string, respectively.
Prefix
For example, "Disc" is a prefix of "Discretopia".
In a variable-length encoding, suppose \(a\) is \(01\) and \(b\) is \(010.\) Then, because \(a\) is a prefix of \(b\), decoding the binary string \(010101\) becomes ambiguous. With a Huffman tree, you can make prefix-free codes instead.
Suffix
For example, "ia" is a suffix of "Discretopia".