This is the pop-up flow.
[close]
#include<bits/stdc++.h> int max(int a, int b); int lcs( char *X, char *Y, int m, int n ) { if (m == 0 || n == 0) return 0; if (X[m-1] == Y[n-1]) return 1 + lcs(X, Y, m-1, n-1); else return max(lcs(X, Y, m, n-1), lcs(X, Y, m-1, n)); } int max(int a, int b) { return (a > b)? a : b; } int main() { char X[] = "AGGTAB"; char Y[] = "GXTXAYB"; int m = strlen(X); int n = strlen(Y); printf("Length of LCS is %d\n", lcs( X, Y, m, n ) ); return 0; }
This is the pop-up flow.
[close]
SOLVE 5 /* A Naive recursive implementation of LCS problem */ #include<bits/stdc++.h> int max(int a, int b); /* Returns length of LCS for X[0..m-1], Y[0..n-1] */ int lcs( char *X, char *Y, int m, int n ) { if (m == 0 || n == 0) return 0; if (X[m-1] == Y[n-1]) return 1 + lcs(X, Y,
This is the pop-up flow.
[close]
SOLVE 5 /* A Naive recursive implementation of LCS problem */ #include<bits/stdc++.h> int max(int a, int b); /* Returns length of LCS for X[0..m-1], Y[0..n-1] */ int lcs( char *X, char *Y, int m, int n ) { if (m == 0 || n == 0) return 0; if (X[m-1] == Y[n-1]) return 1 + lcs(X, Y,
This is the pop-up flow.
[close]
solve 4 #include<stdio.h> #include<limits.h> // Matrix Ai has dimension p[i-1] x p[i] for i = 1..n int MatrixChainOrder(int p[], int i, int j) { if(i == j) return 0; int k; int min = INT_MAX; int count; // place parenthesis at different places between first // an
This is the pop-up flow.
[close]
SOLVE 6 * C++ Program to Find All Pairs Shortest Path */ #include <iostream> #include <cstdlib> #define max 10 #define infi 999 using namespace std; int p[max][max]; /* * All Pairs Shortest Path using Floyd's Algorithm */ void allpairshort(int a[max][max], int n) { int k, i, j;
This is the pop-up flow.
[close]
For ODD: Solve 2: #include<iostream> #include<conio.h> #include<stdlib.h> using namespace std; int cost[10][10],i,j,k,n,qu[10],front,rare,v,visit[10],visited[10]; main() { int m; cout <<"enterno of vertices"; cin >> n; cout <<"ente no of edges"; cin >> m; cout <<"\nEDGES \n"; for(k=1;k<=m;k++) { c
This is the pop-up flow.
[close]
For even: Solve 2: #include<iostream> #include<conio.h> #include<stdlib.h> using namespace std; int cost[10][10],i,j,k,n,qu[10],front,rare,v,visit[10],visited[10]; main() { int m; cout <<"enterno of vertices"; cin >> n; cout <<"ente no of edges"; cin >> m; cout <<"\nEDGES \n"; for(k=1;k<=m;k++) { c
This is the pop-up flow.
[close]
For Even: Solve 1: #include<stdio.h> #include<conio.h> void main() { int path[5][5],i,j,min,a[5][5],p,st=1,ed=5,stp,edp,t[5],index; printf("enter the cost matrix\n"); for(i=1;i<=5;i++) for(j=1;j<=5;j++) scanf("%d",&a[i][j]); printf("enter number of paths\n"); scanf("%d",&p); printf("enter possible
This is the pop-up flow.
[close]
#include<stdio.h> #include<conio.h> void main() { int path[5][5],i,j,min,a[5][5],p,st=1,ed=5,stp,edp,t[5],index; printf("enter the cost matrix\n"); for(i=1;i<=5;i++) for(j=1;j<=5;j++) scanf("%d",&a[i][j]); printf("enter number of paths\n"); scanf("%d",&p); printf("enter possible paths\n"); for(i=1;
This is the pop-up flow.
[close]
hi