Gradient LabSign up free

Home / GATE DA / Data structures and algorithms

GATE DA Data Structures and Algorithms PYQs with solutions

Every data structures and algorithms question from the GATE DA papers of 2026, 2025, 2024: 21 questions worth 30 marks. This covers sorting, searching, recurrences, trees, graphs, BFS and DFS, hashing and complexity. 6 are solved free; the rest are in the past-paper pack (₹499).

2026: 5 questions (7 marks) · 2025: 6 questions (9 marks) · 2024: 10 questions (14 marks)

GATE DA 2026

Q.15Recurrence for randomized-input quicksort
Quicksort expected time · 1 mark · MCQ
Q.25Rebuild a binary tree from pre-order and in-order
Tree reconstruction from traversals · 1 mark · MSQ (more than one correct)
Q.31Worst-case comparisons for a missing key in 1000 items
Binary search comparisons · 1 mark · Numerical answer
Q.40Reachability in G and its reverse
Graph reversal and reachability · 2 marks · MCQ
Q.49Comparisons on a nearly sorted array
Bubble vs insertion sort · 2 marks · MSQ (more than one correct)

GATE DA 2025

Q.18Where 14 and 15 land in a hash table
Linear probing · 1 mark · MCQ
Free
Q.27When is worst-case binary search O(log n)
Binary search requirements · 1 mark · MSQ (more than one correct)
Q.29Values of x giving exactly two swaps
Insertion sort swaps · 1 mark · MSQ (more than one correct)
Free
Q.58Which edges cannot exist given three shortest paths
Shortest paths · 2 marks · MSQ (more than one correct)
Q.64Sum produced by a push-then-pop loop
Stack simulation · 2 marks · Numerical answer
Free
Q.65Vertices discovered after vertex 50
DFS discovery order · 2 marks · Numerical answer
Free

GATE DA 2024

Q.14Edge type when d[u] < d[v] in DFS
DFS edge classification · 1 mark · MCQ
Q.16Match FIFO, lookup and LIFO
Stacks, queues, hash tables · 1 mark · MCQ
Q.21Expected probes to insert with load factor α
Open addressing hash tables · 1 mark · MCQ
Q.28Which traversal pairs pin down a full binary tree
Tree reconstruction from traversals · 1 mark · MSQ (more than one correct)
Q.30Swaps when quicksort meets a sorted array
Quicksort swaps · 1 mark · Numerical answer
Q.32Final value after deque operations
Deque operations · 1 mark · Numerical answer
Free
Q.40Worst-case comparisons of binary search
Binary search recurrence · 2 marks · MCQ
Q.45Which sorts finish [4, 3, 2, 1, 5] in two passes
Sorting algorithm passes · 2 marks · MCQ
Free
Q.51Valid topological orders of a DAG
Topological sort · 2 marks · MSQ (more than one correct)
Q.52Height, internal nodes and leaves of a binary tree
Binary tree size bounds · 2 marks · MSQ (more than one correct)

Other subjects

General Aptitude · Machine learning · Artificial intelligence · Programming · Databases · Probability and statistics · Linear algebra · Calculus and optimization