The GATE Grind

GATE Programming, Data Structures and Algorithms: Stacks, queues, linked lists, trees and hash tables – Previous Year Questions

8 GATE previous year questions on Stacks, queues, linked lists, trees and hash tables (Programming, Data Structures and Algorithms, Data Science and Artificial Intelligence) with answers and explanations, from every paper.

  1. GATE 2024 DA Q16 (1 mark, Multiple choice) – Match the items in Column 1 with the items in Column 2 in the following table: Column 1 Column 2 --- --- (p) First In First Out (i) Stacks (q) Lookup…
  2. GATE 2024 DA Q21 (1 mark, Multiple choice) – Consider performing uniform hashing on an open address hash table with load factor = nm < 1, where n elements are stored in the table with m slots.…
  3. GATE 2024 DA Q28 (1 mark, Multiple select) – Consider the following tree traversals on a full binary tree: (i) Preorder (ii) Inorder (iii) Postorder Which of the following traversal options…
  4. GATE 2024 DA Q32 (1 mark, Numerical answer) – The fundamental operations in a double-ended queue D are: insertFirst(e) – Insert a new element e at the beginning of D. insertLast(e) – Insert a new…
  5. GATE 2024 DA Q52 (2 marks, Multiple select) – Let H, I, L, and N represent height, number of internal nodes, number of leaf nodes, and the total number of nodes respectively in a rooted binary…
  6. GATE 2025 DA Q18 (1 mark, Multiple choice) – Consider a hash table of size 10 with indices \0, 1, , 9\, with the hash function h(x) = 3x 10, where linear probing is used to handle collisions. The…
  7. GATE 2025 DA Q64 (2 marks, Numerical answer) – Consider the following pseudocode. The value of sum output by a program executing the above pseudocode is (*Answer in integer*)
  8. GATE 2026 DA Q25 (1 mark, Multiple select) – You are given the following Pre-order and In-order traversals of a Binary Tree T with nodes E, F, G, P, Q, R, S. Pre-order: P Q S E R F G In-order: S…