GATE CS Formula Sheet for Quick Revision

GATE CS important formulas on one page: algorithms, data structures, OS, networks, COA, digital logic, DBMS, discrete maths and probability, with solved checks.

This page collects the formulas that GATE CS numerical questions use most, subject by subject. Use it for last-month revision; each section links to the full lesson.

Algorithms and data structures

FormulaMeaning
T(n) = aT(n/b) + Θ(n^k)Master theorem: compare a with b^k. a < b^k → Θ(n^k); a = b^k → Θ(n^k log n); a > b^k → Θ(n^(log_b a))
Binary tree with n nodesn − 1 edges; n₀ = n₂ + 1 (leaves = nodes with two children + 1)
Height-h binary treeAt most 2^(h+1) − 1 nodes (root at height 0)
Heap of n elementsHeight ⌊log₂ n⌋; build-heap is O(n)
Number of BSTs with n keysCatalan number C(2n, n)/(n + 1)
Hashing with load factor αChaining: expected search ≈ 1 + α; open addressing unsuccessful search ≤ 1/(1 − α)
Simple graph with n verticesAt most n(n − 1)/2 edges; a tree has n − 1 edges

See Complexity, Recursion and recurrences and Binary trees.

Operating systems

FormulaMeaning
Turnaround time = completion − arrivalWaiting time = turnaround − burst
EAT (paging with TLB) = h(t + m) + (1 − h)(t + 2m)h = TLB hit ratio, t = TLB time, m = memory time (single-level table)
EAT (page faults) = (1 − p)m + p × fault service timep = page-fault rate
Page table size = (number of pages) × (entry size)Number of pages = 2^(virtual address bits) / page size
Deadlock-free with n processes each needing k unitsResources ≥ n(k − 1) + 1

See CPU scheduling, Paging and Deadlocks.

Computer networks

FormulaMeaning
Transmission time = L / BPropagation time = d / v
Stop-and-wait efficiency = 1 / (1 + 2a)a = propagation time / transmission time
Sliding window efficiency = min(1, W / (1 + 2a))W = window size
Go-Back-N: W ≤ 2^k − 1; Selective Repeat: W ≤ 2^(k−1)k = sequence number bits
/n prefix2^(32−n) addresses, 2^(32−n) − 2 usable hosts
CSMA/CD minimum frameL ≥ 2 × B × propagation delay

See Flow control and IP addressing.

Computer organization

FormulaMeaning
CPU time = IC × CPI × clock periodSpeedup = old time / new time
Pipeline of k stages, n instructions(k + n − 1) cycles; ideal speedup → k
Average access time = h × c + (1 − h) × (c + m)Cache with hit ratio h (hierarchical access)
Direct-mapped addresstag + index (log₂ lines) + offset (log₂ block size)
k-way set associativesets = lines / k; index = log₂ sets

See Pipelining and Cache memory.

Digital logic and number systems

  • n-bit 2's complement range: −2^(n−1) to 2^(n−1) − 1.
  • A function of n variables: 2^(2^n) Boolean functions; 2^n minterms.
  • A mod-N counter needs ⌈log₂ N⌉ flip-flops.
  • IEEE 754 single precision: 1 sign, 8 exponent (bias 127), 23 mantissa bits.

See Signed numbers and Floating point.

Databases

  • A relation with n attributes has 2^n − 1 non-empty attribute sets, each a possible super key.
  • B+ tree of order p (pointers per node): a node other than the root has at least ⌈p/2⌉ children.
  • The natural join of R (r tuples) and S (s tuples) has at most r × s tuples.
  • Number of serial schedules of n transactions: n!.

See Normalization and Indexing.

Discrete mathematics and probability

FormulaMeaning
Relations on an n-set2^(n²); reflexive 2^(n² − n); symmetric 2^(n(n+1)/2)
Functions A → B, A has m and B has n elementsn^m; one-one n!/(n − m)!
Derangements D(n)n! Σ (−1)^k / k!
Handshaking lemmaΣ degrees = 2 × edges
Euler's formula (planar connected)V − E + F = 2
Bayes' theoremP(A given B) = P(B given A) P(A) / P(B)
Binomialmean np, variance np(1 − p)
Poissonmean = variance = λ
Exponentialmean 1/λ, variance 1/λ²

See Combinatorics, Relations and Probability.

Check yourself

GATE-styleMCQ · one correct answer

Using the master theorem, T(n) = 8T(n/2) + n² is:

Show answer and explanationAnswer: C

a = 8, b = 2, k = 2: b^k = 4 < 8, so T(n) = Θ(n^(log₂ 8)) = Θ(n³).

GATE-styleNAT · numerical answer

TLB time 10 ns, memory time 100 ns, TLB hit ratio 0.9, single-level page table. What is the effective access time in ns?

Show answer and explanationAnswer: 120

EAT = 0.9 × 110 + 0.1 × 210 = 99 + 21 = 120 ns.

GATE-styleNAT · numerical answer

A link has transmission time 1 ms and propagation time 2 ms. What is the stop-and-wait efficiency? (Give 2 decimal places.)

Show answer and explanationAnswer: 0.20

a = 2/1 = 2, efficiency = 1 / (1 + 2 × 2) = 1/5 = 0.20.

GATE-styleNAT · numerical answer

A 5-stage pipeline executes 100 instructions with no stalls. How many clock cycles does it take?

Show answer and explanationAnswer: 104

k + n − 1 = 5 + 100 − 1 = 104 cycles.

GATE-styleNAT · numerical answer

How many symmetric relations are there on a set of 4 elements?

Show answer and explanationAnswer: 1024

2^(n(n+1)/2) = 2^10 = 1024.

GATE-styleNAT · numerical answer

How many usable host addresses does a /27 subnet have?

Show answer and explanationAnswer: 30

2^5 = 32 addresses, minus the network and broadcast addresses: 30.

GATE-styleNAT · numerical answer

3 processes each need at most 4 units of a resource. What is the minimum number of units that guarantees no deadlock?

Show answer and explanationAnswer: 10

n(k − 1) + 1 = 3 × 3 + 1 = 10.

GATE-styleNAT · numerical answer

How many structurally different binary search trees can store the keys 1, 2, 3, 4?

Show answer and explanationAnswer: 14

Catalan number C(8, 4)/5 = 70/5 = 14.