Webpage

Arrays, Stacks, Queues, Linked lists, Trees, Binary search trees, Binary heaps, Graphs.

$$\scriptsize{\overset{{\large{\textbf{Mark Distribution in Previous GATE}}}}{\begin{array}{|c|c|c|c|c|c|c|c|}\hline
\textbf{Year}&\textbf{2024-1} &\textbf{2024-2} &\textbf{2023} & \textbf{2022} & \textbf{2021-1}&\textbf{2021-2}&\textbf{Minimum}&\textbf{Average}&\textbf{Maximum}
\\\hline\textbf{1 Mark Count} & 0&0&2 &2 &4&2&0&1.67&4
\\\hline\textbf{2 Marks Count} &1&2&3& 1 &1&0&0&1.33&3
\\\hline\textbf{Total Marks} &2&4&8& 4&6&2&\bf{2}&\bf{4.33}&\bf{8}\\\hline
\end{array}}}$$

Previous GATE Questions in DS

#101
3.8k
views
4 answers
14 votes
Consider a singly linked list having $n$ nodes. The data items $d_1, d_2, \dots d_n$ are stored in these $n$ nodes. Let $X$ be a pointer to the $j^{\text{th}}$ node $(1 \...
#102
5.2k
views
3 answers
26 votes
The following Pascal program segments finds the largest number in a two-dimensional integer array $A[0\dots n-1, 0\dots n-1]$ using a single loop. Fill up the boxes to co...
#103
4.9k
views
3 answers
23 votes
Consider the following piece of 'C' code fragment that removes duplicates from an ordered list of integers.Node *remove-duplicates (Node* head, int *j) { Node *t1, *t2; ...
#104
5.2k
views
2 answers
28 votes
An array $A$ contains $n \geq 1$ positive integers in the locations $A , A , \dots A[n]$. The following program fragment prints the length of a shortest sequence of conse...
#105
5.1k
views
3 answers
22 votes
A size-balanced binary tree is a binary tree in which for every node the difference between the number of nodes in the left and right subtree is at most $1$. The distance...
#106
10.8k
views
6 answers
54 votes
Consider a hash table with $n$ buckets, where external (overflow) chaining is used to resolve collisions. The hash function is such that the probability that a key value ...
#107
9.3k
views
6 answers
45 votes
Let $G$ be the graph with $100$ vertices numbered $1$ to $100$. Two vertices $i$ and $j$ are adjacent if $\vert i-j \vert =8$ or $\vert i-j \vert=12$. The number of con...
#108
25.1k
views
5 answers
56 votes
A priority queue $Q$ is used to implement a stack that stores characters. PUSH (C) is implemented as INSERT $(Q, C, K)$ where $K$ is an appropriate integer key chosen by ...
#109
37.8k
views
7 answers
48 votes
A binary search tree contains the value $1, 2, 3, 4, 5, 6, 7, 8$. The tree is traversed in pre-order and the values are printed out. Which of the following sequences is a...
#110
8.8k
views
3 answers
28 votes
Which of the following is essential for converting an infix expression to the postfix form efficiently?An operator stackAn operand stackAn operand stack and an operator s...
#111
19.7k
views
5 answers
44 votes
The concatenation of two lists is to be performed on $O(1)$ time. Which of the following implementations of a list should be used?Singly linked listDoubly linked listCirc...
#112
16.8k
views
12 answers
57 votes
In a binary tree with $n$ nodes, every node has an odd number of descendants. Every node is considered to be its own descendant. What is the number of nodes in the tree ...
#113
11.7k
views
3 answers
43 votes
The height of a tree is defined as the number of edges on the longest path in the tree. The function shown in the pseudo-code below is invoked as height (root) to compute...
#114
32.4k
views
9 answers
48 votes
We are given a set of $n$ distinct elements and an unlabeled binary tree with $n$ nodes. In how many ways can we populate the tree with the given set so that it becomes a...
#115
8.3k
views
2 answers
23 votes
A max-heap is a heap where the value of each parent is greater than or equal to the value of its children. Which of the following is a max-heap?
#116
13.9k
views
10 answers
59 votes
Consider the C function given below. Assume that the array $listA$ contains $n (>0)$ elements, sorted in ascending order.int ProcessArray(int *listA, int x, int n) { in...
#117
20.1k
views
7 answers
56 votes
Consider the pseudocode given below. The function $DoSomething()$ takes as argument a pointer to the root of an arbitrary tree represented by the $leftMostChild-rightSibl...
#118
22.4k
views
3 answers
49 votes
Consider a hash table with $100$ slots. Collisions are resolved using chaining. Assuming simple uniform hashing, what is the probability that the first $3$ slots are unfi...
#119
32.0k
views
8 answers
119 votes
Suppose we have a balanced binary search tree $T$ holding $n$ numbers. We are given two numbers $L$ and $H$ and wish to sum up all the numbers in $T$ that lie between $L$...
#120
16.9k
views
9 answers
50 votes
Consider the following rooted tree with the vertex labeled $P$ as the root:The order in which the nodes are visited during an in-order traversal of the tree is$\text{SQPT...