Recent questions tagged dynamic-programming

0 0 votes
1 1 answer
1.9k
1.9k views
The number of possible paranthesizations of a sequence of n matrices isO(n)$\theta$(n Ig n)$\Omega(2^n)$None of the above
3 3 votes
2 2 answers
6.3k
6.3k views
Given an array of $n$ elements find the maximum continuous sum in it. For example consider the below array of $n=6$.23 4 -10 2 15 1Answer is 35.
5 5 votes
1 answers 1 answer
1.1k
1.1k views
6. Which one of the following is an optimal substructure property?If $S$ is an optimal solution, then the components of $S$ are not necessarily optimalIf $S$ is an optima...
2 2 votes
3 3 answers
2.8k
2.8k views
Your final exams are over and you are catching up on watching sports on TV. You have a schedule of interesting matches coming up all over the world during the next week. ...
3 3 votes
1 1 answer
910
910 views
There is a thin, long and hollow fibre with a virus in the centre. The virus occasionally becomes active and secretes some side products. The fibre is so thin that new si...
2 2 votes
1 1 answer
794
794 views
At the end of its fifth successful season, the Siruseri Premier League is planning to give an award to the Most Improved Batsman over the five years. For this, an Improve...
1 1 vote
1 answers 1 answer
3.5k
3.5k views
I was reading some of the notes (made easy and ACE) and noticed that some teacher have taught that time complexity for Binary Knapsack O(2^(n/2)). which can not be reduc...
1 1 vote
0 0 answers
1.9k
1.9k views
A certain string-processing language offers a primitive operation which splits a string into two pieces. Since this operation involves copying the original string, it tak...
40 40 votes
4 answers 4 answers
16.1k
16.1k views
The subset-sum problem is defined as follows. Given a set of $n$ positive integers, $S = \{ a_1, a_2, a_3, \dots , a_n \}$, and positive integer $W$, is there a subset of...
57 57 votes
4 answers 4 answers
23.0k
23.0k views
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 ...
53 53 votes
8 answers 8 answers
37.5k
37.5k views
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 scala...
32 32 votes
4 answers 4 answers
11.3k
11.3k views
The Floyd-Warshall algorithm for all-pair shortest paths computation is based onGreedy paradigm.Divide-and-conquer paradigm.Dynamic Programming paradigm.Neither Greedy no...
1 1 vote
1 1 answer
1.7k
1.7k views
Given an array of n numbers, give an algorithm for finding a contiguous subsequence A(i) ...A(j) for which the sum of elements is maximum.Eg. [-2, 11, -4, 13, -5, 2] → 20...
4 4 votes
1 1 answer
1.5k
1.5k views
Given an array which contains both positive and negative integers in it and asked to design an algorithm to find the maximum sum which does not contain two consecutive nu...
0 0 votes
2 answers 2 answers
2.2k
2.2k views
We are given a sequence of $n$ positive numbers $a_{1}, a_{2}, \ldots, a_{n}$ and a fixed number $k>0$. We want to find a pair of numbers $a_{i}$ and $a_{j}$ such that $j...
1 1 vote
1 answers 1 answer
1.2k
1.2k views
i want to understand these better....please explain someone.Travelling salesman problem vs. Minimum cost spanning tree vs. Shortest pathAlso I was just wondering if there...
2 2 votes
2 2 answers
11.9k
11.9k views
For X= BDCABA and Y=ABCBDAB find length of lcs and no of such lcs..(solve it using table method)
0 0 votes
1 1 answer
850
850 views
What does find max subarray return when all elements of array are negative?
1 1 vote
1 answers 1 answer
1.9k
1.9k views
At the end of it's 5th Successful season,The siruseri Permier league is planning to give an award to most improved bowler over 5 years . For this an important Index will ...
91 91 votes
4 answers 4 answers
27.5k
27.5k views
The weight of a sequence $a_0,a_1, \dots, a_{n-1}$ of real numbers is defined as $a_0+a_1/2+ \dots + a_{n-1}/2^{n-1}$. A subsequence of a sequence is obtained by deleting...
48 48 votes
6 answers 6 answers
25.1k
25.1k views
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 in several ways with d...
59 59 votes
4 answers 4 answers
23.0k
23.0k views
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 long...
68 68 votes
9 answers 9 answers
18.7k
18.7k views
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-s...
63 63 votes
9 answers 9 answers
30.1k
30.1k views
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 $...
40 40 votes
3 answers 3 answers
14.0k
14.0k views
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 ...
61 61 votes
6 answers 6 answers
18.3k
18.3k views
The subset-sum problem is defined as follows. Given a set of $n$ positive integers, $S = \{ a_1, a_2, a_3, \dots , a_n \}$, and positive integer $W$, is there a subset of...