DAA LAB

Program for Sum of Subset Problem in C

Program #include <stdio.h> #include <conio.h> void subset(int, int, int); int x[10], w[10], d, count = 0; void main() { int i, n, sum = 0; printf(“\n*********************************************************”); printf(“\n*********************************************************”); printf(“\n** Program for Sum of Subset Problem in C **”); printf(“\n** Created by Sheetal Garg **”); printf(“\n** Assistant Professor **”); printf(“\n** Phone No:9467863365 **”); printf(“\n*********************************************************”); printf(“\n*********************************************************”); printf(“\nEnter the …

Program for Sum of Subset Problem in C Read More »

Program to find Minimum Spanning Tree MST of a graph using Kruskal’s Algorithm in C

Program #include <stdio.h> #include <conio.h> int ne = 1, min_cost = 0; void main() { int n, i, j, min, a, u, b, v, cost[20][20], parent[20]; printf(“****************************************************************”); printf(“\n****************************************************************”); printf(“\n** WAP to find Minimum Spanning Tree MST of a graph **”); printf(“\n** using Kruskal’s Algorithm in C **”); printf(“\n** Created by Sheetal Garg **”); printf(“\n** Assistant …

Program to find Minimum Spanning Tree MST of a graph using Kruskal’s Algorithm in C Read More »

Program to find shortest path from a single source to all nodes using Dijikstra’s Algorithm

Program #include <stdio.h> #include <conio.h> void dij(int, int[20][20], int[20], int[20], int); void main() { int i, j, n, visited[20], source, cost[20][20], d[20]; printf(“****************************************************************”); printf(“\n****************************************************************”); printf(“\n** WAP to find shortest path from a single source to all nodes**”); printf(“\n** using Dijikstra’s Algorithm in C **”); printf(“\n** Created by Sheetal Garg **”); printf(“\n** Assistant Professor **”); printf(“\n** …

Program to find shortest path from a single source to all nodes using Dijikstra’s Algorithm Read More »

Program Breadth First Search in C

Program #include <stdio.h> #include <conio.h> void BFS(int[20][20], int, int[20], int); void main() { int n, a[20][20], i, j, visited[20], source; printf(“****************************************************************”); printf(“\n****************************************************************”); printf(“\n** Program for Breadth First Search in C **”); printf(“\n** Created by Sheetal Garg **”); printf(“\n** Assistant Professor **”); printf(“\n** Phone No:9467863365 **”); printf(“\n****************************************************************”); printf(“\n****************************************************************”); printf(“\nEnter the number of vertices:”); scanf(“%d”, &n); printf(“\nEnter …

Program Breadth First Search in C Read More »

Program to implement 0/1 knapsack problem in C

Program #include <stdio.h> #include <conio.h> #define MAX 50 int p[MAX], w[MAX], n; int knapsack(int, int); int max(int, int); void main() { int m, i, optsoln; printf(“*********************************************************”); printf(“\n*********************************************************”); printf(“\n** WAP to implement 0/1 knapsack problem in C **”); printf(“\n** Created by Sheetal Garg **”); printf(“\n** Assistant Professor **”); printf(“\n** Phone No:9467863365 **”); printf(“\n*********************************************************”); printf(“\n*********************************************************”); printf(“\nEnter no. …

Program to implement 0/1 knapsack problem in C Read More »

Program to find transitive closure of a graph in C

Program #include <stdio.h> #include <conio.h> void warshall(int[10][10], int); void main() { int a[10][10], i, j, n; printf(“*********************************************************”); printf(“\n*********************************************************”); printf(“\n** WAP to find transitive closure of a graph in C **”); printf(“\n** Created by Sheetal Garg **”); printf(“\n** Assistant Professor **”); printf(“\n** Phone No:9467863365 **”); printf(“\n*********************************************************”); printf(“\n*********************************************************”); printf(“\nEnter the number of nodes:”); scanf(“%d”, &n); printf(“\nEnter the …

Program to find transitive closure of a graph in C Read More »

Program to find topological sorting of a graph in C

Program #include <stdio.h> #include<conio.h> void findIndegree(int[10][10], int[10], int); void topological(int, int[10][10]); void main() { int a[10][10], i, j, n; printf(“*********************************************************”); printf(“\n*********************************************************”); printf(“\n** WAP to find topological sorting of a graph in C **”); printf(“\n** Created by Sheetal Garg **”); printf(“\n** Assistant Professor **”); printf(“\n** Phone No:9467863365 **”); printf(“\n*********************************************************”); printf(“\n*********************************************************”); printf(“\nEnter the number of nodes:”); scanf(“%d”, …

Program to find topological sorting of a graph in C Read More »

error: You can only copy the programs code and output from this website. You are not allowed to copy anything else.