Skip to main content
GATE CSE

Algorithms PYQs (GATE CSE Algorithms previous year questions)

Practise real GATE CSE Algorithms previous year questions from 1987–2026. Attempt questions, check your answers and learn with the stored explanations.

  • 255GATE CSE PYQs in archive
  • 1987–202639 exam years
  • 6 chapters45 analysed topics
  • Allhave a verified solution

Practice Questions

Question 1 of 5
GATE CSE 2026AlgorithmsGreedy Method, Dynamic Programming & Algorithm Design Techniques2 marks

Consider a table TT, where the elements T[i][j],0≤i,j≤nT[i][j], 0 \leq i, j \leq n, represent the cost of the optimal solutions of different subproblems of a problem that is being solved using a dynamic programming algorithm. The recursive formulation to compute the table entries is as follows:

T[0][k]=T[k][0]=1 for k=0,1,2,…,nT[i][j]=2T[i−1][j]+3T[i][j−1] for 1≤i,j≤n \begin{array}{ll} T[0][k]=T[k][0]=1 & \text { for } k=0,1,2, \ldots, n \\ T[i][j]=2 T[i-1][j]+3 T[i][j-1] & \text { for } 1 \leq i, j \leq n \end{array}
Consider the following two algorithms to compute entries of TT. Assume that for both the algorithms, for all 0≤i,j≤n,T[i][j]0 \leq i, j \leq n, T[i][j] has been initialized to 1.
Algorithm B1B_{1} : For i=1,2,…,ni=1,2, \ldots, n
 For j=1,2,…,nT[i][j]=2T[i−1][j]+3T[i][j−1] \begin{array}{l} \text { For } j=1,2, \ldots, n \\ \qquad T[i][j]=2 T[i-1][j]+3 T[i][j-1] \end{array}
Algorithm B2:B_{2}: For s=2,3,…,2ns=2,3, \ldots, 2 n
 For i=1,2,…,n For j=1,2,…,n If (i+j==s)T[i][j]=2T[i−1][j]+3T[i][j−1] \begin{array}{l} \text { For } i=1,2, \ldots, n \\ \qquad \begin{array}{l} \text { For } j=1,2, \ldots, n \\ \qquad \text { If }(i+j==s) \\ \quad\quad\quad\quad T[i][j]=2 T[i-1][j]+3 T[i][j-1] \end{array} \end{array}
Algorithm Bk,k∈{1,2}B_{k}, k \in\{1,2\} is said to be correct if and only if it calculates the correct values of T[i][j]T[i][j], for all 0≤i,j≤n0 \leq i, j \leq n, (as per the recursive formulation) at the end of the execution of the algorithm BkB_{k}.

Which one of the following statements is true?

Choose one option

Answer at least one question to submit.

Help us improve: tell us what to fix or add

Sign in to send feedback (it takes under a minute), or create a free account.

About Algorithms

Algorithms has 17 analysed topics in the GateIQ archive. The ones that have appeared most often in GATE CSE are Minimum Spanning Tree, Identify Function, Recurrence Relation.

15 of them are rated high or very high value by the same transparent frequency, recurrence, recentness and solvability weighting used across the archive.

The practice set draws on 255 GATE CSE questions from 39 papers between 1987–2026. 255 of them carry a verified worked solution, shown after you submit.

Topics (45)

Year-wise PYQs

Number of GATE CSE Algorithms questions in each paper.

  • 202611
  • 20259
  • 20249
  • 20233
  • 20223
  • 202114
  • 20205
  • 20194
  • 20186
  • 20177
  • 201611
  • 201515
  • 201417
  • 20134
  • 20124
  • 20117
  • 20105
  • 20098
  • 200815
  • 200711
  • 200612
  • 200510
  • 20048
  • 200313
  • 20023
  • 20013
  • 20005
  • 19996
  • 19982
  • 19971
  • 19964
  • 19955
  • 19945
  • 19932
  • 19922
  • 19913
  • 19901
  • 19881
  • 19871