retagged by
469 views
0 votes
0 votes
For longest common subsequence the total number of subsequence possible for the word DIYA should be 2^4 or (2^4)-1??Please explain.
retagged by

1 Answer

0 votes
0 votes
D I Y A

D, DI, DY, DA, DIY, DIA, DYA, DIYA

I, IY, IA, IYA

Y, YA

A

null ( 0 length)

HERE we can see total 16 subsequences are possible.

there is a difference between sub-string and subsequence, sub-string should be continuous but subsequence may or may not be.

so, string length = n

total subsequences possible = 2$^{n}$
edited by

Related questions

0 votes
0 votes
0 answers
1
karan25gupta asked Apr 17, 2019
689 views
In 0/1 knapsack problem ,suppose if maximum weight is given as W and we are asked to find out max profit then * IS IT NECESSARY THAT THE TOTAL WEIGHT SHOULD BE EXACTLY EQ...
0 votes
0 votes
2 answers
2
Doraemon asked Mar 26, 2019
1,021 views
What advantage does top down approch have over bottom up approach in case of dynamic programming??
0 votes
0 votes
1 answer
3
DIYA BASU asked Feb 14, 2019
498 views
Can we solve fractional knapsack using dynamic programming?
2 votes
2 votes
2 answers
4
Nivedita Singh asked Dec 8, 2018
1,499 views
Is there any shortcut or Trick to get min number of multiplication faster? I mean if we could know the right split.