How arithmetic coding narrows a fraction

Short answer: Arithmetic coding encodes a message as a single fraction of the unit interval. Each symbol narrows the current interval to the subinterval proportional to the symbol’s probability. The encoder emits bits as soon as they are determined by the shrinking interval, and it uses renormalization to keep…

How a treap uses random priorities

Short answer: A treap is a binary search tree on keys and a heap on independently random priorities. Each node stores a key and a priority. The in-order walk is the key order, and every parent has a better priority than its children. Insert and delete are rotations that…