All Categories

Computer Science

Algorithms, information theory and discrete math

Shannon Entropy

Advanced
H=ipilog2piH = -\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[xiyi]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=log2(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+11N = 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
ab=(ab)¬(ab)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(logn)<O(n)<O(nlogn)<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(logn)O(\log n)

Runtime that grows logarithmically with input size.

View details

Linearithmic Time

Intermediate
O(nlogn)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=b1b2bnp = b_1 \oplus b_2 \oplus \cdots \oplus b_n

XOR of data bits used for error detection.

View details

Nyquist Sampling Rate

Advanced
fs2fmaxf_s \geq 2f_{max}

Minimum sampling rate to capture a signal without aliasing.

View details

Nyquist Data Rate

Advanced
C=2Blog2LC = 2B\log_2 L

Maximum data rate of a noiseless channel.

View details

Shannon Channel Capacity

Advanced
C=Blog2(1+SNR)C = B\log_2(1 + SNR)

Maximum error-free data rate of a noisy channel.

View details

Hamming Code Bits

Advanced
2rm+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(1p)+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