Previously Asked Problems of Dynamic Programming on GATE

Q1. [GATE-CS-2016]
The Floyd-Warshall algorithm for all-pair shortest paths computation is based on

(A) Greedy Paradigm
(B) Divide-and-Conquer Paradigm
(C) Dynamic Programming Paradigm
(D) Neither Greedy nor Divide-and- Conquer nor Dynamic Programming Paradigm

Ans: (C) Dynamic Programming Paradigm

Q2. [GATE-CS-2015]

List-I

A. Prim’s algorithm for minimum spanning tree
B. Floyd-Warshall algorithm for all pairs shortest paths
C. Mergesort
D. Hamiltonian circuit

List-II

1. Backtracking
2. Greedy method
3. Dynamic programming
4. Divide and conquer

Codes:

A B C D
(a) 3 2 4 1
(b) 1 2 4 3
(c) 2 3 4 1
(d) 2 1 3 4

Options:

(A): a
(B): b
(C): c
(D): d

Ans: (C)

Q3. [GATE-CS-2017]
Kadane algorithm is generally used to find out.

(A) Maximum sum subsequence present in an array
(B) Maximum sum subarray present in an array
(C) Maximum product subsequence present in an array
(D) Maximum product subarray present in an array

Ans: (B) Maximum sum subarray present in an array

Q4. [GATE-CS-2017]
Which of the standard algorithms shown below is not based on Dynamic Programming?

(A) Prim’s Minimum Spanning Tree
(B) Bellman-Ford Algorithm for single-source shortest path
(C) Floyd Warshall Algorithm for all-pairs shortest paths
(D) 0-1 Knapsack problem

Ans: (A) Prim’s Minimum Spanning Tree

Q5. [GATE-CS-2014]
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 and B. Then x + 10y = ___.

(A) 33
(B) 23
(C) 43
(D) 34

Ans: (D) 34



Dynamic Programming (DP) Notes for GATE Exam [2024]

As the GATE Exam 2024 is coming up, having a good grasp of dynamic programming is really important for those looking to tackle tricky computational problems. These notes are here to help you understand the basic principles, strategies, and real-life uses of dynamic programming. They’re like a handy guide to becoming a pro at dynamic programming, making it easier for you to ace the GATE exam. So, get ready to dive into the world of dynamic programming and make problem-solving a breeze!

Table of Content

  • What is Dynamic Programming?
  • Overlapping Subproblems Property
  • Optimal Substructure Property
  • Standard problems on Dynamic Programming
  • Previously Asked Problems of Dynamic Programming on GATE

Similar Reads

What is Dynamic Programming?

Dynamic Programming is mainly an optimization over plain recursion. Wherever we see a recursive solution that has repeated calls for the same inputs, we can optimize it using dynamic Programming. The idea is to simply store the results of subproblems so that we do not have to re-compute them when needed later. This simple optimization reduces time complexities from exponential to polynomial....

1. Overlapping Subproblems Property:

Like Divide and Conquer, Dynamic Programming combines solutions to sub-problems. Dynamic Programming is mainly used when solutions to the same subproblems are needed again and again. In dynamic programming, computed solutions to subproblems are stored in a table so that these don’t have to be recomputed. So dynamic Programming is not useful when there are no common (overlapping) subproblems because there is no point in storing the solutions if they are not needed again. For example, Binary Search doesn’t have common subproblems. If we take the example of following a recursive program for Fibonacci Numbers, there are many subproblems that are solved again and again....

2. Optimal Substructure Property:

A given problem is said to have Optimal Substructure Property if the optimal solution of the given problem can be obtained by using the optimal solution to its subproblems instead of trying every possible way to solve the subproblems....

Standard problems on Dynamic Programming:

Longest Common Subsequence:...

Previously Asked Problems of Dynamic Programming on GATE:

Q1. [GATE-CS-2016]The Floyd-Warshall algorithm for all-pair shortest paths computation is based on...

Contact Us