     }
 
 }
+

        // Add 'end of stream' symbol.
        symbolOut.append(maxSymbol + 1)

        // Huffman Coding
        let bitWriter = BitWriter(bitOrder: .straight)

        // First, we analyze data and create Huffman trees and selectors.
        // Then we will perform encoding itself.
        // These are separate stages because all information about trees is stored at the beginning of the block,

            }
            t?.code(symbol: symbol)
        }
    }

    static func mtf(_ array: [Int]) -> [Int] {
