C++

Browse posts by tag

Elements of Programming

Notes

Rigorous foundations of generic programming. Connects algebra and algorithms. Stepanov’s magnum opus.

RoaringBitmap

RoaringBitmap

A hybrid compressed bitmap that picks the optimal sub-representation (array, bitmap, or run-length) per 64K-integer chunk based on density. No single prior dominates: Roaring commits to none and adapts per chunk.

Computer Science Mathematics
Choosing the Algebra

Choosing the Algebra

The Stepanov series showed that algorithms arise from algebraic structure. This post is about the flip side: sometimes you choose a different structure to make the algorithm trivial.

Computer Science Mathematics
Arithmetic Coding

Arithmetic Coding

Arithmetic coding closes the gap between Huffman's per-symbol integer lengths and true entropy. A single number in the unit interval encodes an entire sequence; 32-bit integer arithmetic makes it practical.

Computer Science Mathematics
Huffman Coding

Huffman Coding

Given a finite distribution, Huffman's algorithm builds the prefix-free code with minimum expected length. It is the first entropy-optimal code in this series.

Computer Science Mathematics
VByte / Varint

VByte / Varint

VByte trades bit-level precision for byte-alignment, and that trade wins in practice. Most production columnar databases and network protocols use VByte for integer encoding.

Computer Science Mathematics
Rice / Golomb

Rice / Golomb

Rice and Golomb codes are parametric: a single parameter k (or m) tunes the code to a specific geometric distribution. Choosing k is choosing your prior precisely.

Computer Science Mathematics
Fibonacci Coding

Fibonacci Coding

Fibonacci coding uses Zeckendorf's representation to produce self-synchronizing codewords. Every codeword ends in two consecutive ones; a single bit flip corrupts at most two codewords.

Computer Science Mathematics
Elias Delta and Omega

Elias Delta and Omega

Elias delta and omega extend Elias gamma by recursively encoding the length prefix. Each step yields shorter codewords for large integers at a small constant cost for small ones.

Computer Science Mathematics
How Iterators Give You N+M Instead of NxM

How Iterators Give You N+M Instead of NxM

Iterators reduce the NxM algorithm-container problem to N+M by interposing an abstraction layer, following Stepanov's generic programming approach.

Is It Prime?

Is It Prime?

The Miller-Rabin primality test demonstrates how probabilistic algorithms achieve arbitrary certainty, trading absolute truth for practical efficiency.

Computer Science Mathematics