This limits the amount of blocking that is done in practice. A practical alternative, in widespread use, is run-length encoding. This technique adds one step in advance of entropy coding, specifically counting (runs) of repeated symbols, which are then encoded. For the simple case of Bernoulli processes, Golomb coding is optimal among prefix codes for coding run length, a fact proved via the techniques of Huffman coding. A similar approach is taken by fax machines using modified Huffman coding. However, run-length coding is not as adaptable to as many input types as other compression technologies. Many variations of Huffman coding exist, some of which use a Huffman-like algorithm, and others of which find optimal prefix codes (while, for example, putting different restrictions on the output). Note that, in the latter case, the method need not be Huffman-like, and, indeed, need not even be polynomial time. The "n"-ary Huffman algorithm uses the {0, 1, ... , "n" − 1} alphabet to encode message and build an "n"-ary tree. This approach was considered by Huffman in his original paper. The same algorithm applies as for binary ("n" equals 2) codes, except that the "n" least probable symbols are taken together, instead of just the 2 least probable. Note that for "n" greater than 2, not all sets of source words can properly form an "n"-ary tree for Huffman coding. In these cases, additional 0-probability place holders must be added. This is because the tree must form an "n" to 1 contractor; for binary coding, this is a 2 to 1 contractor, and any sized set can form such a contractor. If the number of source words is congruent to 1 modulo "n"-1, then the set of source words will form a proper Huffman tree. A variation called adaptive Huffman coding involves calculating the probabilities dynamically based on recent actual frequencies in the sequence of source symbols, and changing the coding tree structure to match the updated probability estimates. It is used rarely in practice, since the cost of updating the tree makes it slower than optimized adaptive arithmetic coding, which is more flexible and has better compression. Most often, the weights used in implementations of Huffman coding represent numeric probabilities, but the algorithm given above does not require this; it requires only that the weights form a totally ordered commutative monoid, meaning a way to order weights and to add them.