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}}}$$

Most viewed questions in DS

#1
102k
views
7 answers
1 votes
Level of a node is distance from root to that node. For example, level of root is 1 and levels of left and right children of root is 2. The maximum number of nodes on lev...
#2
50.6k
views
17 answers
169 votes
The number of ways in which the numbers $1, 2, 3, 4, 5, 6, 7$ can be inserted in an empty binary search tree, such that the resulting tree has height $6$, is _________.No...
#3
44.1k
views
5 answers
40 votes
What is the maximum height of any AVL-tree with $7$ nodes? Assume that the height of a tree with a single node is $0$.$2$$3$$4$$5$
#4
40.3k
views
13 answers
174 votes
When searching for the key value $60$ in a binary search tree, nodes containing the key values $10, 20, 40, 50, 70, 80, 90$ are traversed, not necessarily in the order gi...
#5
40.0k
views
14 answers
67 votes
The number of possible min-heaps containing each value from $\{1,2,3,4,5,6,7\}$ exactly once is _______
#6
39.8k
views
6 answers
129 votes
You are given the postorder traversal, $P$, of a binary search tree on the $n$ elements $1, 2, \dots, n$. You have to determine the unique binary search tree that has $P...
#7
38.6k
views
7 answers
49 votes
The postfix expression for the infix expression $A+B*(C+D)/F+D*E$ is:$AB + CD + *F/D +E*$$ABCD + *F/DE* ++$$A * B + CD/F *DE ++$$A + *BCD/F* DE ++$
#8
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...
#9
36.3k
views
6 answers
43 votes
A binary tree $T$ has $n$ leaf nodes. The number of nodes of degree $2$ in $T$ is$\log_2 n$$n-1$$n$$2^n$
#10
36.0k
views
6 answers
48 votes
A single array $A[1 \ldots \text{MAXSIZE}]$ is used to implement two stacks. The two stacks grow from opposite ends of the array. Variables $top1$ and $top2$ $(top1 < top...
#11
35.7k
views
12 answers
145 votes
Let $Q$ denote a queue containing sixteen numbers and $S$ be an empty stack. $Head(Q)$ returns the element at the head of the queue $Q$ without removing it from $Q$. Simi...
#12
35.0k
views
6 answers
97 votes
$N$ items are stored in a sorted doubly linked list. For a delete operation, a pointer is provided to the record to be deleted. For a decrease-key operation, a pointer is...
#13
34.1k
views
11 answers
103 votes
A program takes as input a balanced binary search tree with $n$ leaf nodes and computes the value of a function $g(x)$ for each node $x$. If the cost of computing $g(x)$ ...
#14
33.8k
views
6 answers
33 votes
Which of the following permutations can be obtained in the output (in the same order) using a stack assuming that the input is the sequence $\text{1, 2, 3, 4, 5}$ in that...
#15
33.7k
views
8 answers
89 votes
An implementation of a queue $Q$, using two stacks $S1$ and $S2$, is given below: void insert (Q, x) { push (S1, x); } void delete (Q) { if (stack-empty(S2)) then if (sta...
#16
32.9k
views
10 answers
80 votes
In a min-heap with $n$ elements with the smallest element at the root, the $7^{th}$ smallest element can be found in time$\Theta (n \log n)$$\Theta (n)$$\Theta(\log n)$$\...
#17
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...
#18
32.3k
views
3 answers
29 votes
The maximum number of binary trees that can be formed with three unlabeled nodes is:$1$$5$$4$$3$
#19
32.0k
views
12 answers
89 votes
Let S be a stack of size $n \geq1$. Starting with the empty stack, suppose we push the first n natural numbers in sequence, and then perform $n$ pop operations. Assume th...
#20
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$...