Engineering & Science
GATE Computer Science
GATE CS formula & cheat sheet
25 high-yield formulas, shortcuts and facts, grouped by syllabus chapter. Copy any formula as LaTeX, or switch on Quick Revision Mode to see only the bare equations.
25 cards with explanations. Turn on Quick Revision Mode to hide them.
Regular LanguagesTheory of Computation
Pumping lemma for regular languages
Theorem · Pumping lemma
Use it only to prove a language is not regular (it is necessary, not sufficient). Pick cleverly, e.g. for : lies inside the 's, so pumping breaks the balance.
Closure properties of regular languages
Rule · Closure properties
Closed under union, intersection, complement, difference, concatenation, Kleene star, reversal, homomorphism and inverse homomorphism.
Intersection by the product construction ( states); complement by swapping accepting and non-accepting states of a complete DFA. A subset of a regular language need not be regular.
Finite automata facts
Rule · Finite automata
NFA, -NFA, DFA and regular expressions are equally powerful. The minimal DFA of a regular language is unique up to renaming of states.
Context-Free LanguagesTheory of Computation
Pumping lemma for CFLs
Theorem · Context-free grammars
Classic non-CFLs: , , . Two pumped parts move together, which is why survives but does not.
Closure properties of CFLs and DCFLs
Rule · Pushdown automata
CFL: closed under union, concatenation, Kleene star, reversal, homomorphism and intersection with a regular language; not closed under intersection or complement. DCFL: closed under complement; not under union or intersection.
Counter-example for intersection: , which is not context-free. DPDAs are strictly weaker than NPDAs ( needs non-determinism).
ComputabilityTheory of Computation
Chomsky hierarchy
Rule · Chomsky hierarchy
Type 3 regular ↔ finite automaton · Type 2 context-free ↔ PDA · Type 1 context-sensitive ↔ linear bounded automaton · Type 0 unrestricted ↔ Turing machine (RE).
Decidability at a glance
Rule · Undecidability
Membership: decidable for regular, CFL, CSL and recursive; undecidable for RE. Emptiness: decidable for regular and CFL; undecidable for CSL and above. Equivalence: decidable for regular; undecidable for CFL and above. CFG ambiguity and the halting problem: undecidable.
Rice's theorem: every non-trivial property of the language accepted by a Turing machine is undecidable. Recursive languages are closed under complement; RE languages are not (L and its complement both RE ⇒ L recursive).
Asymptotic AnalysisAlgorithms
Master theorem
Theorem · Master theorem
Compare with . Case 3 needs the regularity condition with . Examples: ; ; .
Common recurrences
Formula · Recurrences
For recurrences substitute : turns them into ordinary recurrences in .
Order of growth and sorting bounds
Rule · Big-O notation
Comparison sorting needs . Merge sort and heap sort: always. Quick sort: average , worst . Insertion sort: best , worst . Counting sort: .
Algorithm DesignAlgorithms
BFS and DFS
Formula · Graph algorithms
BFS gives shortest paths in unweighted graphs. DFS finds cycles, topological order (DAGs) and connected and strongly connected components, all in O(V + E).
Shortest-path algorithms
Formula · Graph algorithms
Dijkstra (binary heap) fails with negative edge weights. Bellman–Ford handles negative edges and detects negative cycles ( relaxation rounds, then one check). Floyd–Warshall gives all-pairs shortest paths.
Minimum spanning tree
Formula · Greedy algorithms
An MST has edges. If all edge weights are distinct, the MST is unique. Both algorithms rely on the cut property: the lightest edge crossing any cut belongs to some MST.
Classic dynamic programming problems
Formula · Dynamic programming
DP applies when a problem has optimal substructure and overlapping subproblems. 0/1 knapsack is pseudo-polynomial: is a number, not an input size. Fractional knapsack is solved greedily in .
Process ManagementOperating Systems
Banker's algorithm: safe state
Rule · Deadlocks
Start with . Repeatedly pick any unfinished process whose need fits; if all processes can finish, the state is safe and that order is a safe sequence. An unsafe state is not necessarily deadlocked.
Minimum resources to avoid deadlock
Formula · Deadlocks
With every process could hold and wait forever; one more instance guarantees someone can finish. Four necessary conditions: mutual exclusion, hold and wait, no preemption, circular wait.
Scheduling metrics
Formula · Scheduling
SJF minimises average waiting time (when all jobs are available). Round Robin with a very large quantum behaves like FCFS; a very small quantum adds context-switch overhead.
Memory ManagementOperating Systems
Effective memory access time with a TLB
Formula · Page tables
= TLB hit ratio, = TLB time, = memory access time, = page-table levels ( gives on a miss). If TLB lookup is overlapped with memory access, drop from the miss term.
Effective access time with page faults
Formula · Virtual memory
= page-fault rate, = page-fault service time (milliseconds, so even a tiny dominates). FIFO can show Belady's anomaly; LRU and Optimal cannot.
Pages, offset and page-table size
Formula · Paging
Example: 32-bit address, 4 KB pages, 4-byte PTE → pages, page table. Physical frames .
Network LayerComputer Networks
Subnets and hosts
Formula · Subnetting
For a prefix. The two excluded addresses are the network address (all host bits 0) and the broadcast address (all host bits 1). A /30 gives exactly 2 usable hosts, for point-to-point links.
CIDR masks
Rule · IP addressing
Columns: prefix, mask, usable hosts. Classful ranges (first octet): A 1–126, B 128–191, C 192–223, D (multicast) 224–239. 127.x.x.x is loopback.
Data Link LayerComputer Networks
Sliding window efficiency
Formula · Sliding window
= frame transmission time, = propagation delay. With -bit sequence numbers: Go-Back-N window ; Selective Repeat window .
Transport LayerComputer Networks
TCP window, throughput and BDP
Formula · Flow control
The window must be at least the bandwidth-delay product to keep the link full. Without window scaling the advertised window is at most 65,535 bytes. The sender uses min(rwnd, cwnd).
TCP congestion control
Rule · Congestion control
Slow start: cwnd doubles every RTT (+1 MSS per ACK) until ssthresh. Congestion avoidance: +1 MSS per RTT. Timeout: ssthresh = cwnd/2, cwnd = 1 MSS. 3 duplicate ACKs (Reno fast recovery): ssthresh = cwnd/2, cwnd = ssthresh.
Slow start is exponential, congestion avoidance is linear (additive increase, multiplicative decrease, AIMD). Tahoe resets cwnd to 1 MSS on both timeout and triple duplicate ACK.
Frequently asked questions
- What does the GATE CS cheat sheet cover?
- 25 revision cards across Regular Languages, Context-Free Languages, Computability, Asymptotic Analysis, Algorithm Design, Process Management, Memory Management, Network Layer, Data Link Layer, Transport Layer, each tied to the GATE CS syllabus.
- Can I print it or use it offline?
- Yes. Use the Print button for a clean paper copy, and once you have opened the page it stays available offline in the browser or the installed app.
- What is Quick Revision Mode?
- It hides the explanatory notes so only the formulas and key facts show, for a fast last-minute revision pass.