Skip to content
Early access — you're among the first to try PYQLabs. Share feedback

Dynamic Programming

GATE CSE & IT · 19 questions across 10 years (1991-2024) · 25% recurrence rate

Recurrence sparkline

1991–2024
199120082024

Difficulty mix

easy 32%
med 68%

Question types

MCQ11
NAT6
MSQ1
OTHER1

All 19 questions on Dynamic Programming

2024 PYQ

Let $A$ be an array containing integer values. The distance of $A$ is defined as the minimum number of elements in $A$ that must be replaced with another integer so that the resulting array is sorted in non-decreasing or...

Med
2021 PYQ

Define R n to be the maximum amount earned by cutting a rod of length n meters into one or more pieces of integer length and selling them. For i > 0, let p[i] denotes the selling price of a rod whose length is i meters....

Med✓
2018 PYQ

Assume that multiplying a matrix $${G_1}$$ of dimension $$p \times q$$ with another matrix $${G_2}$$ of dimension $$q \times r$$ requires $$pqr$$ scalar multiplications. Computing the product of $$n$$ matrices $${G_1}{G_...

Med✓
2018 PYQ

Consider the weights and values of items listed below. Note that there is only one unit of each item. Item number Weight (in Kgs) Value (in Rupees) 1 10 60 2 7 28 3 4 20 4 2 24 The task is to pick a subset of these items...

Med
2016 PYQ

Let $${A_1},\,{A_2},\,{A_3}$$ and $${A_4}$$ be four matrices of dimensions $$10 \times 5,\,5 \times 20,\,20 \times 10,$$ and $$10 \times 5,$$ respectively. The minimum number of scalar multiplications required to find th...

Med
2016 PYQ

Let $${A_1},{A_2},{A_3},$$ and $${A_4}$$ be four matrices of dimensions $$10 \times 5,\,\,5 \times 20,\,\,20 \times 10,$$ and $$10 \times 5,\,$$ respectively. The minimum number of scalar multiplications required to find...

Med
2016 PYQ

The Floyd-Warshall algorithm for all-pair shortest paths computation is based on

Easy✓
2014 PYQ

Suppose you want to move from 0 to 100 on the number line. In each step, you either move right by a unit distance or you take a shortcut. A shortcut is simply a pre specified pair of integers i, j with i < j. Given a sho...

Easy
2014 PYQ

Consider two strings A = “qpqrr” and B = “pqprqrp”. Let x be the length of the longest common subsequence (not necessarily contiguous) between A and B and let y be the number of such longest common subsequences between A...

Med
2011 PYQ

Four matrices $${M_1},\,\,\,{M_2},\,\,\,{M_3}$$ and $${M_4}$$ of dimensions $$p\,\,x\,\,q,\,\,\,\,\,q\,\,x\,\,e,\,\,\,\,\,r\,\,x\,\,s$$ and $$\,\,\,\,s\,\,x\,\,t$$ respectively can be multiplied in sevaral ways with diff...

Med✓
2011 PYQ

Four matrices M 1 , M 2 , M 3 and M 4 of dimensions p $$\times$$ q, q $$\times$$ r, r $$\times$$ s and s $$\times$$ t respectively can be multiplied is several ways with different number of total scalar multiplications....

Med✓
2011 PYQ

An algorithm to find the length of the longest monotonically increasing sequence of numbers in an array A[0:n−1] is given below. Let L i , denote the length of the longest monotonically increasing sequence starting at in...

Easy✓
2009 PYQ

A sub-sequence of a given sequence is just the given sequence with some elements (possibly none or all) left out. We are given two sequences X[m] and Y[n] of lengths m and n, respectively with indexes of X and Y starting...

Med✓
2009 PYQ

A sub-sequence of a given sequence is just the given sequence with some elements (possibly none or all) left out. We are given two sequences X[m] and Y[n] of lengths m and n, respectively with indexes of X and Y starting...

Easy✓
2008 PYQ

The subset-sum problem is defined as follows. Given a set of n positive integers, S = {a 1 ,a 2 ,a 3 ,…,a n } and positive integer W, is there a subset of S whose elements sum to W? A dynamic program for solving this pro...

Med✓
2008 PYQ

The subset-sum problem is defined as follows. Given a set of n positive integers, S = {a 1 ,a 2 ,a 3 ,…,a n } and positive integer W, is there a subset of S whose elements sum to W? A dynamic program for solving this pro...

Easy✓
2008 PYQ

Consider the following C functions: int f1(int n){ if(n == 0 || n == 1){ return n; } return (2 * f1(n - 1) + 3 * f1(n - 2)); } int f2(int n){ int i; int X[N], Y[N], Z[N]; X[0] = Y[0] = Z[0] = 0; X[1] = 1; Y[1] = 2; Z[1]...

Med✓
2005 PYQ

Consider the following C - function: double foo(int n){ int i; double sum; if(n == 0) return 1.0; sum = 0.0; for (i = 0; i < n; i++){ sum += foo(i); } return sum; } Suppose we modify the above function foo() and store th...

Easy✓
1991 PYQ

Obtain the optimal binary search tree with equal probabilities for the identifier set (a 1 , a 2 , a 3 ) = ( if, stop, while)

Med