GatePlus logoGatePlus
GATE CS 2027 / ALGORITHMS & DATA STRUCTURES

GATE CS Algorithms & Data Structures: analyse, design and prove.

Build problem-solving depth across asymptotic analysis, sorting, trees, graphs, greedy methods and dynamic programming—with clear complexity models and common exam traps.

GatePlus editorial · Published 24 November 2026 · Independent study guide
Practise GATE questions ↗

Use the official syllabus as your boundary

This is an independent GATE CS 2027 study guide, not an official syllabus or a prediction of questions. Check the official GATE 2027 CS syllabus PDF ↗ and use the GatePlus syllabus overview as a checklist.

1. Asymptotic analysis and recurrences

  • Interpret O, Ω and Θ as asymptotic upper, lower and tight bounds. Constants and lower-order terms are ignored for sufficiently large input size; do not confuse worst-case, average-case and amortised complexity.
  • Know growth order: constant, logarithmic, polylogarithmic, linear, n log n, polynomial and exponential. Compare functions using ratios or logarithms when needed.
  • For divide-and-conquer recurrences T(n)=aT(n/b)+f(n), compare f(n) with nlog_b a using the Master theorem conditions. Check regularity and polynomial-gap conditions rather than applying a memorised case mechanically.
  • For non-standard recurrences, expand a few levels, draw the recursion tree and sum work per level. State base cases and floors/ceilings if they affect the result.

Quick model: Merge sort performs Θ(n) merge work over Θ(log n) levels, giving Θ(n log n). Binary search has Θ(log n) worst-case comparisons on a sorted random-access array.

2. Searching, sorting and order statistics

AlgorithmTypical timeKey property
Insertion sortBest Θ(n), worst Θ(n²)Stable; adaptive on nearly sorted input
Merge sortΘ(n log n)Stable; array implementation needs auxiliary space
Heap sortΘ(n log n)In-place; not stable in standard form
QuicksortExpected Θ(n log n), worst Θ(n²)Partitioning; pivot choice matters
Counting sortΘ(n+k)Non-comparison sort for bounded integer keys
  • Comparison sorting has a worst-case lower bound Ω(n log n) in the decision-tree model.
  • Build-heap bottom-up is Θ(n), not Θ(n log n). Repeated insertion can take Θ(n log n).
  • For selection, distinguish finding the minimum/maximum, kth smallest and the median. Randomised Quickselect has expected linear time; worst case can be quadratic.
  • Stability preserves the relative order of equal keys. In-place and stable are separate properties.

3. Stacks, queues, linked lists and hashing

  • Stacks are LIFO; queues are FIFO. Trace push/pop or enqueue/dequeue sequences explicitly and watch for underflow, overflow and circular-buffer wraparound.
  • For a circular queue of capacity N, distinguish implementations that reserve one empty slot from implementations that maintain an explicit count or full flag.
  • Linked-list insertion/deletion can be O(1) when the required node or predecessor is already available; searching for a position remains O(n).
  • Hash-table expected operation time depends on the hash distribution and load factor. Separate chaining and open addressing have different collision and deletion behaviour.
  • Linear probing suffers primary clustering. Quadratic probing and double hashing alter probe sequences; for open addressing, deletion often requires tombstones rather than clearing a slot.

4. Trees, BSTs, AVL trees and heaps

  • For a binary tree, distinguish height measured in edges from height measured in nodes. State the convention before calculating.
  • In a BST, inorder traversal gives keys in sorted order. Search, insert and delete are O(h), where h is tree height; an unbalanced tree can have h=Θ(n).
  • AVL trees maintain a balance factor in {−1,0,+1}. Recognise LL, RR, LR and RL imbalance patterns and apply single or double rotations.
  • A binary heap is a complete binary tree with heap-order property. Insert and extract-min/max take O(log n); peek is O(1); bottom-up construction is O(n).
  • Know tree traversals, subtree sizes, height/leaf relationships, and how recursive traversal cost relates to the number of nodes.

5. Graph representations and traversals

  • Adjacency matrices use Θ(V²) space and support O(1) edge lookup; adjacency lists use Θ(V+E) space and are efficient for sparse graphs.
  • BFS explores in nondecreasing distance (number of edges) from a source in an unweighted graph. DFS explores depth-first and supports cycle detection, connected components and topological ordering on DAGs.
  • Topological ordering exists only for directed acyclic graphs. A DFS finishing-time order is one method; Kahn’s algorithm repeatedly removes zero-indegree vertices.
  • For an adjacency-list graph, BFS and DFS take O(V+E). For an adjacency matrix, scanning neighbours can take O(V²).
  • Distinguish traversal order from DFS discovery/finish times and from a topological ordering. Multiple valid orders may exist depending on adjacency ordering.

6. Shortest paths, MSTs and graph properties

AlgorithmProblem / conditionTypical complexity
BFSUnweighted shortest pathsO(V+E)
DijkstraNonnegative edge weightsO((V+E) log V) with a binary heap and adjacency lists
Bellman–FordNegative edges; detects reachable negative cyclesO(VE)
Floyd–WarshallAll-pairs shortest pathsO(V³)
Kruskal / PrimMinimum spanning tree in a connected, undirected weighted graphCommonly O(E log V)
  • Dijkstra’s greedy choice is not valid with arbitrary negative edge weights.
  • A spanning tree of a connected graph has V−1 edges. An MST minimises total weight; it need not be unique when edge weights tie.
  • Kruskal sorts edges and uses disjoint-set union to avoid cycles. Prim grows one tree by repeatedly choosing a minimum crossing edge.
  • For DAG shortest paths, topological-order relaxation works even with negative edge weights because there are no directed cycles.

7. Greedy, dynamic programming and backtracking

  • Greedy algorithms make locally optimal choices. Prove correctness using an exchange argument, cut property or another appropriate invariant; examples include interval scheduling and MST algorithms.
  • Dynamic programming applies when subproblems overlap and an optimal substructure exists. Define state, transition, base cases and evaluation order before filling a table.
  • For 0/1 knapsack, each item is either selected or not; for fractional knapsack, sorting by value/weight ratio is optimal. Do not transfer the fractional greedy proof to 0/1 knapsack.
  • Backtracking explores a state-space tree and prunes infeasible or non-promising branches. Worst-case complexity can remain exponential.
  • For DP questions, identify whether the table represents prefixes, suffixes, intervals, subsets or graph vertices. Check dimensions and whether iteration order permits reuse of an item.

8. Disjoint sets, amortised analysis and complexity classes

  • Disjoint-set union supports MAKE-SET, FIND and UNION. Path compression plus union by rank/size gives near-constant amortised operation time, commonly expressed with the inverse Ackermann function.
  • Amortised analysis bounds a sequence of operations, not the expected cost of one random operation. Aggregate, accounting and potential methods are standard approaches.
  • Know the definitions and relationships among P, NP, NP-hard and NP-complete. NP means solutions can be verified in polynomial time; it does not mean “not polynomial”.
  • To show NP-completeness, establish membership in NP and a polynomial-time reduction from a known NP-complete problem. Reduction direction matters.

9. GATE problem-solving checklist

  1. Write the input size and whether the question asks worst, average, expected or amortised complexity.
  2. For recurrences, identify a, b and f(n), then verify theorem conditions.
  3. For tree questions, draw the exact structure and record the height convention.
  4. For graph questions, write the representation, edge direction, weights and tie-breaking rule.
  5. For DP, define state and transition in words before calculating entries.
  6. For sorting, track comparisons, swaps, stability and auxiliary space separately.

Frequently asked questions

Which topics should I prioritise?

Build strong foundations in asymptotic analysis, trees, heaps, graph traversals, shortest paths, MSTs, sorting, hashing and dynamic programming. Use the official syllabus and PYQs to tune depth.

Does every DFS order give a topological sort?

No. A reverse finishing-time order is topological only for a directed acyclic graph. A DFS traversal sequence itself is not automatically a topological order.

Is this an official GATE document?

No. It is an independent learning resource. The official GATE syllabus remains authoritative.

Explore the complete GATE CS subject library: compare all nine subject guides, follow the syllabus sequence and jump to the topic you need in the GATE CS subject-guide directory ↗.

Turn concepts into timed practice.

Use the GatePlus roadmap, chapter practice and test review to connect your preparation with the problems you can solve. All currently available GatePlus learning tools are free.

Open Tests & practice ↗