Programming & Data Structures — Solved PYQ & Mock Arena
Topic-wise Programming & Data Structures previous-year GATE & UGC NET questions with step-by-step LaTeX solutions
In a Binary Max-Heap containing distinct elements stored in a 1-indexed array H[1..100], in which subarray index range MUST the minimum element reside?
How many times is the printf statement executed when fun(6) is called for void fun(int n) { if (n <= 1) return; fun(n - 1); printf("*"); fun(n - 2); }?
The Preorder traversal of a Binary Search Tree (BST) is 30, 20, 10, 15, 25, 23, 39, 35, 42. Which of the following is its Postorder traversal?
Keys 12, 18, 13, 2, 3, 23, 5, 15 are inserted in order into an initially empty hash table of size using and Linear Probing. At which index is key 15 placed?
What is the minimum number of nodes in a height-balanced AVL tree of height (where a single root node has height )?
Evaluate the postfix expression 10 5 + 60 6 / * 8 - using a standard operand stack.
Consider the C snippet int x = 0, y = 5, z = 10; int k = (x && ++y) || (z++ && ++x);. What is the value of y + z + x + k after execution?
In C, let int A[4][5] be stored in Row-Major order starting at base memory address 1000 with sizeof(int) = 4 bytes. What are the numerical address values of (A + 2) and (&A + 1) respectively?
What integer value is printed by the following C program?
#include <stdio.h>
int f(int n) {
static int r = 0;
if (n <= 0) return 1;
if (n > 3) {
r = n;
return f(n - 2) + 2;
}
return f(n - 1) + r;
}
int main(void) {
printf("%d", f(5));
return 0;
}
Which open-addressing collision resolution technique eliminates both primary and secondary clustering?
What is the minimum number of nodes in an height-balanced AVL tree of height (where a single root node has height )?
Evaluate the postfix (Reverse Polish) expression: 8 2 3 ^ / 2 3 * + 5 1 * - where ^ denotes exponentiation.
What is the tight worst-case time complexity of building a Binary Max-Heap bottom-up (Build-Max-Heap) from an unsorted array of elements?
A binary tree has nodes with degree (two children) and nodes with degree . How many leaf nodes (degree ) does the binary tree contain?
What integer value is returned by calling f(5) for the C function int f(int n) { static int r = 0; if (n <= 0) return 1; if (n > 3) { r = n; return f(n - 2) + 2; } return f(n - 1) + r; }?