Web Page

Searching, Sorting, Hashing, Asymptotic worst case time and Space complexity, Algorithm design techniques: Greedy, Dynamic programming, and Divide‐and‐conquer, Graph search, Minimum spanning trees, Shortest paths.

$$\scriptsize{\overset{{\large{\textbf{Mark Distribution in Previous GATE}}}}{\begin{array}{|c|c|c|c|c|c|c|c|c|c|c|c|c|c|}\hline \textbf{Year}& \textbf{2026 - 1}& \textbf{2026 - 2}& \textbf{2025 - 1}& \textbf{2025 - 2}& \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}&4&4&2&2&1&2&2&2&3&2&1&2.4&4\\\hline \textbf{2 Marks Count}&6&4&3&3&4&2&2&2&3&4&2&3.3&6\\\hline \textbf{Total Marks}&16&12&8&8&9&6&6&6&9&10&\bf{6}&\bf{9}&\bf{16}\\\hline \end{array}}}$$

Recent activity in Algorithms

14 14 votes
4 4 answers
2.3k
2.3k views
Let $G(V, E)$ be an undirected, edge-weighted graph with integer weights. The weight of a path is the sum of the weights of the edges in that path. The length of a path i...
2 2 votes
3 3 answers
476
476 views
The Floyd-Warshall algorithm is used on a directed graph with 4 vertices (labelled 1, 2, 3, 4). The initial shortest distances are given by an adjacency matrix where "inf...
82 82 votes
7 answers 7 answers
45.6k
45.6k views
Let $G$ be a simple undirected graph. Let $T_D$ be a depth first search tree of $G$. Let $T_B$ be a breadth first search tree of $G$. Consider the following statements.No...
48 48 votes
6 6 answers
30.6k
30.6k views
Given an integer array of size $N$, we want to check if the array is sorted (in either ascending or descending order). An algorithm solves this problem by making a single...
81 81 votes
6 answers 6 answers
30.1k
30.1k views
An unordered list contains $n$ distinct elements. The number of comparisons to find an element in this list that is neither maximum nor minimum is$\Theta(n \log n)$$\Thet...
23 23 votes
3 3 answers
1.7k
1.7k views
You are working on a dynamic programming problem defined by the recurrence:\[ A(i, j) = F\!\big( A(\lfloor i/2 \rfloor,\, j),\; A(i,\, \lfloor j/2 \rfloor) \big), \]where...
73 73 votes
3 answers 3 answers
3.8k
3.8k views
Let $T(n)=2 T(n / 2)+O(n),$ where "$O$" is big-oh. What will be asymptotic bound on $T(n)?$$\Theta(n)$$\Theta(n \log n)$$\Theta\left(n^ 2\right)$$O\left(n^ 3\right)$
72 72 votes
4 answers 4 answers
36.9k
36.9k views
A message is made up entirely of characters from the set $X=\{P, Q, R, S, T\}$. The table of probabilities for each of the characters is shown below:$$\begin{array}{|c|c|...
1 1 vote
1 1 answer
1.5k
1.5k views
My answer came out to be 13:because when we will compute T(13){as we are using Dynamic programming , it will have to compute value of T(12),T(11),…...T(2) only once(as it...
0 0 votes
0 0 answers
46
46 views
$1000$ candidates appear in a competitive examination. There are $50$ questions, each worth $2$ marks. There is no partial credit, and each answer is awarded either $0$ m...
0 0 votes
0 0 answers
40
40 views
Let $T(n)$ be the number of ways to tile a $3 \times n$ rectangle with $1 \times 2$ dominoes; refer to the figure for some examples for the case $n=4$.Which of the follow...
0 0 votes
0 0 answers
35
35 views
The below question pertain to the pseudocode given below, which defines the function $f(x)$ (where $x$ is assumed to be a nonnegative integer). The code uses the function...
0 0 votes
0 0 answers
38
38 views
The below question pertain to the pseudocode given below, which defines the function $f(x)$ (where $x$ is assumed to be a nonnegative integer). The code uses the function...
0 0 votes
0 0 answers
35
35 views
In the Pots-of-Gold game, there is a row of $n$ pots $P_{1}, \ldots, P_{n}$. Each pot contains some number of gold coins. You remove pots and collect the gold coins from ...
46 46 votes
14 14 answers
22.7k
22.7k views
The number of edges present in the forest generated by the $\text{DFS}$ traversal of an undirected graph $G$ with $100$ vertices is $40$. The number of connected componen...
13 13 votes
3 3 answers
2.4k
2.4k views
Let $G$ be a weighted directed acyclic graph with $m$ edges and $n$ vertices. Given $G$ and a source vertex $s$ in $G$, which one of the following options gives the worst...
64 64 votes
15 answers 15 answers
52.5k
52.5k views
Consider the following recurrence relation.$$T(n) = \begin{cases} T(n/2) + T(2n/5) + 7n & \text{if } n 0 \\ 1 & \text{if } n = 0 \end{cases}$$Which one of the following ...
60 60 votes
16 16 answers
27.8k
27.8k views
​​​​​Let $\text{T(n)}$ be the recurrence relation defined as follows:\[\begin{array}{l}T(0)=1, \\T(1)=2, \text { and } \\T(n)=5 T(n-1)-6 T(n-2) \text { for } n \geq 2\end...
81 81 votes
14 answers 14 answers
39.8k
39.8k views
Let $A$ be an array of $31$ numbers consisting of a sequence of $0$'s followed by a sequence of $1$'s. The problem is to find the smallest index $i$ such that $A\left [i ...
87 87 votes
10 answers 10 answers
39.8k
39.8k views
In the following C function, let $n \geq m$.int gcd(n,m) { if (n%m == 0) return m; n = n%m; return gcd(m,n); }How many recursive calls are made by this function?$\Theta(\...
11 11 votes
3 3 answers
1.5k
1.5k views
Consider two statements $\text{S1}$ and $\text{S2}$.$\text{S1}:$ To solve the single-source-shortest-paths (SSSP) problem for a graph with no negative-weight edges, it is...
73 73 votes
6 answers 6 answers
36.8k
36.8k views
Consider functions $\textsf{Function_1}$ and $\textsf{Function_2}$ expressed in pseudocode as follows:Function_1 while n>1 do for i=1 to n do x = x + 1; end for n = ⌊n/2⌋...
9 9 votes
2 answers 2 answers
5.5k
5.5k views
A complete graph G with 5 nodes has positive weight edges,each edge has a distinct weight with an integer value and maximum weight is equal to number of edges in G.What c...
65 65 votes
4 answers 4 answers
18.8k
18.8k views
Consider a $\textit{dynamic}$ hashing approach for $4$-bit integer keys:There is a main hash table of size $4$.The $2$ least significant bits of a key is used to index in...
0 0 votes
1 1 answer
109
109 views
Q.${Solve}$ ${Recurrence}$.$T(n) = T\left(\frac{n}{15}\right) + T\left(\frac{n}{10}\right) + 2T\left(\frac{n}{6}\right) + \sqrt{n}$ 
120 120 votes
22 answers 22 answers
57.7k
57.7k views
Let $G$ be a complete undirected graph on $4$ vertices, having $6$ edges with weights being $1, 2, 3, 4, 5,$ and $6$. The maximum possible weight that a minimum weight s...
88 88 votes
14 answers 14 answers
24.3k
24.3k views
Let $\textit{G(V,E)}$ be a directed graph, where $\textit{V} = \{ 1, 2, 3, 4, 5 \}$ is the set of vertices and $\textit{E}$ is the set of directed edges, as defined by th...
7 7 votes
2 2 answers
950
950 views
Consider the following $0-1$ knapsack problem with the item's weight and value given in the table.$$\begin{array}{c|cc} \text{item} & \text{weight} & \text{value} \\\hlin...
62 62 votes
6 answers 6 answers
31.7k
31.7k views
An array of $25$ distinct elements is to be sorted using quicksort. Assume that the pivot element is chosen uniformly at random. The probability that the pivot element ge...
21 21 votes
3 3 answers
3.6k
3.6k views
Consider the recursive functions represented by the following code segment:int bar(int n) { if (n == 1) return 0; else return 1 + bar(n/2); } int foo(int n) { if (n == 1)...
To see more, click for all the questions in this category.