Program: /* Q8.WAP to color your graph using given 4 colors(r,g,b,y).Print all the possible combinations of colors which can...
Read More
15 Program to perform Dijkstra Algorithm to Find Shortest Path Source Vertex
Program: /* Dijkstra's Algorithm */ #include<iostream> #define INF INT_MAX using namespace std; class Gra...
Read More
14 Program to perform Kruskal's Algorithm to find the Minimum Cost Spanning Tree.
Steps: 1) Add Edges in Ascending Order by their Weight 2) Do not Create a Cycle. If any edge is Creating a Cycle Skip that Edge Prog...
Read More
13 Program to perform Prims Algorithm to find the Minimum Cost Spanning Tree.
Program: /* Prims Algorithm */ #include<iostream> #define INF INT_MAX using namespace std; class Graph { int g[20...
Read More
12 Program to find Spanning Tree
Program: /* Spanning Tree 6 0 0 0 0 1 0 2 1 3 2 3 1 4 4 3 4 5 3 5 2 5 -1 -1 */ #include<iostream> #define INF 9999...
Read More
11 Program to implement Topological Sort
Program: /* Q1.WAP to implement topological sort. */ #include<iostream> using namespace std; class Graph { int **...
Read More
10 Program to find Transitive Closure of a Graph using Warshall's Algorithm
Program: /* Warshall's Algorithm */ #include<iostream> using namespace std; class Graph { int g[20][20]; int...
Read More
9 Program to create AVL (Adelson-Velsky and Landis) Tree and perform Delete Operation.
Program: #include<iostream> using namespace std; class Node { public: int data; Node* left, *right; Node() ...
Read More
9 Program to find Transitive Closure by using Matrix Multiplication
Program: /* Scan adjacency matrix of graph.Find transitive closure by using matrix multiplication. */ #include <iostre...
Read More
8 Program to perform BFS (Breadth First Search) on Graph
Process: Program: /* BFS */ #include<iostream> using namespace std; class Node { public: int vertex; int weight...
Read More
8 Program to Create Threaded Binary Tree from given Binary Search Tree
Program: /* WAP to create a TBT from given BST. */ #include<iostream> using namespace std; class Node { public: in...
Read More
7 Program to perform Non-Recursive DFS to check if graph is connected or not. Print number of components of a graph.
Program: /* Q5.Scan edges from user for an undirected graph.Create adjacency list.Perform nonrecursive DFS to check if grap...
Read More
7 Program to Create Threaded Binary Tree and Perform Delete Operation
Program: /*Q4.WAP to implement TBT with following functions. -create() recursive -delete() recursive */ #include <iostre...
Read More
6 Program to Check Graph contain Cycle or Not
Program: /* Q3.Scan adj matrix for a directed graph.Check if graph is cyclic or not. */ #include<iostream> using nam...
Read More
6 Program to Create Threaded Binary Tree and Perform Inorder, Preorder and Postorder Traversal
TBT Structure: Program: /* Q3.WAP to implement TBT with following functions. -create() -preorder() -postorder() -preo...
Read More
5 Program to Check if there is a path between any 2 vertices of Graph.
Program: /* Q5.Create an adj matrix for directed graph.Check if there is a path between any 2 vertices of graph. */ #includ...
Read More
5 Program to Create Simple Binary Tree. Find leaf node of any node, Height of any node and Delete a Node from Tree.
Program: /* Simple Binary Tree -create() -recursive inorder() -nonrecursive preorder -search data -find leaf node of any No...
Read More
4 Program to Print Number of Components in a given Graph.
Program: /* Q4-Create adj list from adj matrix.Check if graph is connected or not. Print number of components. */ #include...
Read More
4 Program to Create Non-Recursive Binary Search Tree and Non-Recursive Postorder Traversal and findmin function
Program: #include<iostream> #include<string.h> #define MAX 100 using namespace std; class Node { public: in...
Read More
Subscribe to:
Posts (Atom)