All Categories

Computer Science

Algorithms, information theory and discrete math

This Computer Science formula category brings together key results from algorithms, information theory, and discrete math, from Shannon Entropy and the Master Theorem to binary conversions, Hamming distance, and common time complexities. It’s a practical reference for students, exam prep, and anyone doing real-world programming or systems work, helping you quickly understand data, analyze performance, and solve core computing problems with confidence.

Shannon Entropy

Advanced
H=−∑ipilog⁡2piH = -\sum_i p_i \log_2 p_i

Average information content of a random source (bits).

View details

Master Theorem (form)

Advanced
T(n)=aT(n/b)+f(n)T(n) = aT(n/b) + f(n)

Analyzes running time of divide-and-conquer algorithms.

View details

Hamming Distance

Advanced
d(x,y)=∑i[xi≠yi]d(x,y) = \sum_i [x_i \ne y_i]

Number of positions at which two strings differ.

View details

Bits to Represent n

Basic
b=⌈log⁡2(n)⌉b = \lceil \log_2(n) \rceil

Minimum number of bits to represent n distinct values.

View details

Binary to Decimal

Basic
N=∑i=0kbi2iN = \sum_{i=0}^{k} b_i 2^i

Converts a binary number to decimal.

View details

Nodes in a Full Binary Tree

Intermediate
N=2h+1−1N = 2^{h+1} - 1

Total nodes in a perfect binary tree of height h.

View details

Decimal to Binary

Basic
N=repeated division by 2N = \text{repeated division by } 2

Convert a decimal number to binary by dividing by 2 and reading remainders.

View details

Hexadecimal to Decimal

Basic
N=∑i=0khi16iN = \sum_{i=0}^{k} h_i 16^i

Convert a hexadecimal number to decimal.

View details

XOR Operation

Intermediate
a⊕b=(a∨b)∧¬(a∧b)a \oplus b = (a \lor b) \land \lnot(a \land b)

Exclusive OR: true when exactly one input is true.

View details

Two's Complement

Advanced
−N=¬N+1-N = \lnot N + 1

Represents negative integers in binary by inverting bits and adding one.

View details

Common Time Complexities

Intermediate
O(1)<O(log⁡n)<O(n)<O(nlog⁡n)<O(n2)<O(2n)O(1) < O(\log n) < O(n) < O(n\log n) < O(n^2) < O(2^n)

Ordering of common algorithmic growth rates.

View details

Logarithmic Time

Intermediate
O(log⁡n)O(\log n)

Runtime that grows logarithmically with input size.

View details

Linearithmic Time

Intermediate
O(nlog⁡n)O(n\log n)

Runtime of efficient comparison sorts.

View details

Quadratic Time

Basic
O(n2)O(n^2)

Runtime that grows with the square of input size.

View details

Exponential Time

Advanced
O(2n)O(2^n)

Runtime that doubles with each added element.

View details

Master Theorem Form

Advanced
T(n)=aT(n/b)+f(n)T(n) = aT(n/b) + f(n)

General form for analyzing divide-and-conquer recurrences.

View details

Data Transfer Time

Basic
t=SRt = \frac{S}{R}

Time to transfer data of a given size at a rate.

View details

Address Space

Intermediate
N=2nN = 2^n

Number of addressable locations for n bits.

View details

Hexadecimal to Decimal

Basic
d=∑hi×16id = \sum h_i \times 16^i

Convert a hex number to decimal by positional weights.

View details

Parity Bit

Intermediate
p=b1⊕b2⊕⋯⊕bnp = b_1 \oplus b_2 \oplus \cdots \oplus b_n

XOR of data bits used for error detection.

View details

Nyquist Sampling Rate

Advanced
fs≥2fmaxf_s \geq 2f_{max}

Minimum sampling rate to capture a signal without aliasing.

View details

Nyquist Data Rate

Advanced
C=2Blog⁡2LC = 2B\log_2 L

Maximum data rate of a noiseless channel.

View details

Shannon Channel Capacity

Advanced
C=Blog⁡2(1+SNR)C = B\log_2(1 + SNR)

Maximum error-free data rate of a noisy channel.

View details

Hamming Code Bits

Advanced
2r≥m+r+12^r \geq m + r + 1

Parity bits r needed to protect m data bits.

View details

Average Memory Access Time

Advanced
AMAT=H+M×PAMAT = H + M \times P

Effective access time from hit time, miss rate, and penalty.

View details

Amdahl Law

Advanced
S=1(1−p)+p/sS = \frac{1}{(1-p) + p/s}

Maximum speedup from parallelizing a fraction of a task.

View details

Throughput

Basic
X=NTX = \frac{N}{T}

Number of operations completed per unit time.

View details