Information Theory
Entropy as the floor no lossless coder beats, the coders that approach it, channel capacity, and error detection versus correction. Interviewers probe it whenever size or reliability is at stake.
part ofComputer science fundamentalsoverview, primer and where to startread it →on this pageshowhide
explore
- Uncertainty Measures18 questions
- Surprisal & Bit Units4 questions
- Shannon Entropy4 questions
- Conditional & Joint Entropy5 questions
- Mutual Dependence & Divergence5 questions
- Compression Limits15 questions
- Prefix Codes & Kraft5 questions
- Pigeonhole Counting Bound5 questions
- Kolmogorov Complexity5 questions
- Lossless Compressors21 questions
- Huffman Codes5 questions
- Arithmetic & Range Coding6 questions
- Sliding-Window Dictionaries6 questions
- Run-Length & Block Sorting4 questions
- Lossy Compression10 questions
- Quantization Error5 questions
- Rate-Distortion Curve5 questions
- Noisy Transmission31 questions
- Symmetric & Erasure Channels5 questions
- Channel Capacity5 questions
- Parity & Checksums5 questions
- Cyclic Redundancy Checks5 questions
- Hamming Distance & Codes5 questions
- Reed-Solomon & Erasure Coding6 questions
- Computer Scienceskillanchors this topic
- AI & Data Scientistrole
- Backend Developerrole
- Blockchain Developerrole
- Data Analystrole
- Data Engineerrole
- Forward Deployed Engineerrole
- Full Stack Developerrole
- Game Developerrole
- Java Backend Developerrole
- Kotlin Backend Developerrole
- Machine Learning Engineerrole
- Server-Side Game Developerrole
- Software Architectrole
questions
95 · 5 sectionsWhat does the Shannon entropy of an event log's status field, measured in bits, actually tell you?
basics
~20 sShannon entropy is the average surprisal of a field's values in bits: the sum of p times log2(1/p) over every value. It measures how uncertain the next value is, not how many distinct values exist.
In information terms, an alert that fires in one minute out of 1024 carries ten bits of surprisal - what does that number mean?
basics
~20 sTen bits is the surprisal of an outcome with probability 1/1024, since -log2(1/1024) = 10. One bit is the uncertainty resolved by one fair yes/no answer, so rarer outcomes carry more bits and a certain one carries zero.
How does the chain rule H(X,Y) = H(X) + H(Y|X) price storing both columns of a routing log?
basics
~20 sThe chain rule prices a column pair as the first column's entropy plus whatever surprise the second still holds: H(X,Y) = H(X) + H(Y|X). Storing both together therefore never costs more than storing each separately, and usually costs less.
What does a conditional entropy H(data centre | region) of 0.54 bits tell you about a two-column routing log?
basics
~20 sConditional entropy H(data centre | region) is the data-centre uncertainty left, on average, once the region is known. At 0.54 bits against 2 bits unconditioned, the region nearly fixes the data centre, but not completely.
A candidate fraud signal shows zero mutual information with the fraud label — what does that tell you?
basics
~20 sZero mutual information means the signal and the label are independent in the distribution you measured: observing one removes none of the other's uncertainty. The reading is symmetric, it is an estimate, and it says nothing about the signal's value alongside other signals.
A compression tool claims it makes every possible input file smaller — why is that claim impossible?
basics
~20 sLossless compression must be reversible, so distinct inputs need distinct outputs. There are more n-bit inputs than shorter strings, so no map can shrink them all; a scheme that shrinks one input must expand another.
Why does an archival tier re-compressing already-compressed or encrypted blocks get output slightly larger than the input?
basics
~20 sAlready-compressed and encrypted blocks have no repeated sequences and a near-uniform byte distribution, so the coder finds nothing to exploit and emits at least as much as it read, plus headers — a few bytes of growth per block.
Which test tells you whether a prefix code exists with codeword lengths of 1, 2, 3, 3 and 3 bits?
basics
~20 sKraft's inequality: sum two to the minus each codeword length and compare with 1. For 1, 2, 3, 3 and 3 that sum is 1.125, above the budget, so no prefix code has those lengths.
A binary envelope packs variable-length field tags back to back with no separator bits - why must those tag codewords be prefix-free?
basics
~20 sPrefix-free means no codeword is the opening of another, so a decoder reading bit by bit knows a symbol has ended the instant it recognises one. Without that property it must look ahead or carry explicit lengths and separators.
What guarantee does a stored-raw fallback block give a lossless container, and what does it cost?
basics
~20 sA stored-raw block lets the writer emit a block's original bytes whenever coding them would be bigger, so worst-case expansion is capped by that block's small header rather than by the coder's behaviour — usually a small fraction of a percent.
Run-length encoding replaces repeats with count-symbol pairs, so on what input does it make the output larger?
basics
~20 sRun-length encoding expands any input whose symbols rarely repeat: a single symbol still costs a count plus the symbol, so alternating bytes double in size. It pays only when the average run is longer than one pair.
How does an arithmetic coder turn a whole message into a single subinterval of [0,1)?
basics
~20 sAn arithmetic coder starts with [0,1) and narrows it once per symbol, keeping the slice whose width is that symbol's probability. The final interval's width is the message's probability, and a number inside it identifies the whole message.
How does a sliding-window compressor encode a repeated byte sequence as a length-distance back-reference?
basics
~20 sA sliding-window compressor keeps the most recent N bytes it has already produced as its window. When the next bytes repeat something inside that window, it emits a pair of numbers, a distance back and a match length, instead of the bytes.
How does Huffman coding build a code tree from a table of next-hop identifier frequencies?
basics
~20 sHuffman coding repeatedly removes the two lowest-frequency trees and joins them under a new node weighted by their sum, until one tree remains. Each symbol's code is its root-to-leaf path, so rare symbols sink deepest and frequent ones stay shallow.
The Burrows-Wheeler transform and move-to-front emit as many symbols as they consume, so what do they buy a compressor?
basics
~20 sNothing by themselves — they remove no bytes at all. They reshape the symbol distribution so that the entropy coder behind them, which is the stage that actually removes bits, meets a far more skewed and predictable stream.
A preview pipeline offers a lossy encoder for every stored artifact; which payload classes must refuse it, and why?
basics
~20 sAnything whose value is its exact bits must stay lossless: executables, archives, source, ledgers, and anything later checked by a digest or signature. Lossy fits terminal media a human tolerates approximately, never the master copy everything else is derived from.
How does the bit depth of a recorder covering a fixed input range set the size of its worst-case quantization error?
basics
~20 sBit depth b splits a fixed range R into 2^b levels, so the uniform step is R divided by 2^b and round-to-nearest keeps every in-range sample within half a step. Each added bit halves the step and drops the error floor by about 6 dB.
A capture is quantized, gain-adjusted, then quantized again at the same bit depth; when does the second pass add error?
basics
~20 sRe-rounding values that already sit on the same grid changes nothing. Any gain change, resample or range change moves the grid under them, so each such pass can add another half step, and the coarsest stage in the chain dominates the total.
For a fidelity budget D, what does the rate-distortion function R(D) actually claim about any encoder?
basics
~20 sR(D) is the lowest average rate, in bits per source symbol, at which a source can be reproduced with average distortion at most D under a chosen distortion measure. It is a bound no scheme beats, non-increasing and convex, so extra bits buy steadily less.
In a recorder that maps a fixed input range onto b bits, why does clipping fail differently from ordinary rounding error?
basics
~20 sRounding error is bounded by half a quantization step and sits at a fixed low level. Clipping is unbounded: samples outside the input range flatten onto the endpoint, producing signal-correlated distortion that extra bits cannot reduce.
A single parity bit is appended to each data word: which corruptions does a parity recheck catch, and which slip through?
basics
~20 sA parity recheck catches every odd number of flipped bits in the codeword and misses every even number. It cannot say which bit flipped, cannot repair anything, and is blind to bits that were reordered rather than flipped.
A noisy link has a channel capacity of 0.53 bits per channel use - what does that number promise and what does it forbid?
basics
~20 sChannel capacity is a reliable-rate ceiling. Any code carrying fewer than 0.53 data bits per channel use can be made as close to error-free as you like by using long enough blocks; no code above that rate can, however much redundancy it adds.
On a binary symmetric channel with crossover probability p, what does p predict about a thousand-bit block over a radio link?
basics
~20 sA binary symmetric channel flips each transmitted bit independently with probability p, and the receiver cannot see which bits changed. With p = 0.001 a thousand-bit block averages one flip, yet only about 37 percent of blocks arrive clean.
In a binary erasure channel the receiver sees which positions vanished; why is that cheaper to repair than a flip?
basics
~20 sRepair has two halves: finding the damaged position and fixing its value. An erasure hands you the position for free, so only the value must be recovered, which takes roughly half the redundancy a silent flip of unknown location needs.
Which corruptions slip past a one's-complement additive checksum on a configuration blob pushed over a serial link?
basics
~20 sAn additive sum is unchanged by reordering whole words, by inserting or deleting a word that adds nothing, and by two changes that cancel each other. Any change confined to a single word is caught, which is what makes the holes structural rather than random.