Skip to content

Commit

Permalink
Merge pull request #57 from i-vishi/master
Browse files Browse the repository at this point in the history
updated
  • Loading branch information
i-vishi authored Oct 2, 2018
2 parents 1ced910 + a15eec5 commit 9debede
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@

/* Implementation of LCS problem using DP*/
#include<iostream>
#include<cstring>
#include<cstdlib>
/* Implementation of LCS problem using Dynamic Programming*/
#include <bits/stdc++.h>

using namespace std;

Expand Down Expand Up @@ -36,11 +34,13 @@ void lcs(string X, string Y){
else
j--;
}
//output
cout << "LCS of " << X << " and " << Y << " is " << lcs;
}

int main(){
string a,b;
//input two strings
cin>>a;
cin>>b;
lcs(a,b);
Expand Down
4 changes: 3 additions & 1 deletion Dynamic Programming/Subset-Sum.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
#include <bits/stdc++.h>

using namespace std;

// Returns true if there is a subset of set[] with sun equal to given sum

bool isSubsetSum(int set[], int n, int sum){
bool subset[n+1][sum+1];
for (int i = 0; i <= n; i++)
Expand All @@ -24,7 +26,7 @@ bool isSubsetSum(int set[], int n, int sum){
int main()
{
int n,sum;
//input n - size of set and sum
//input n - size of set and sum to which it has to be compared
cin>>n>>sum;
int set[n];
//input elements of set
Expand Down

0 comments on commit 9debede

Please sign in to comment.