This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include<bits/stdc++.h> | |
using namespace std; | |
struct Node{ | |
int data; | |
Node *left; | |
Node *right; | |
}; | |
Node* newNode(int x) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include<bits/stdc++.h> | |
using namespace std; | |
int adj[10][10]; | |
int visited[10]; | |
void create_graph(int n,int m) | |
{ | |
int i,j,k,src,dest; | |
for(j=0;j<n;j++) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include<bits/stdc++.h> | |
#define INF 0x3f3f3f3f | |
#define V 4 | |
using namespace std; | |
list< pair<int,int> > adj[V]; | |
void addedge(int u,int v,int w) | |
{ | |
adj[u].push_back(make_pair(v,w)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include<iostream> | |
using namespace std; | |
int main() | |
{ | |
int ar[4][4]={{0,1,0,1},{1,0,1,1},{0,0,0,1},{1,0,1,0}}; | |
for(int k=0;k<4;k++) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include<iostream> | |
#include<vector> | |
#include<queue> | |
using namespace std; | |
int adj[10][10]; | |
vector<int> indegree; | |
vector<int> order; | |
queue<int> q; | |
void create_graph(int n) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include<iostream> | |
#include<stack> | |
#define initial 0 | |
#define visited 1 | |
using namespace std; | |
int adj[10][10]; | |
int state[10]; | |
void create_graph(int n) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include<iostream> | |
#include<stack> | |
#define initial 0 | |
#define visited 1 | |
#define finished 2 | |
using namespace std; | |
int adj[10][10]; | |
int rev_adj[10][10]; | |
int state[10]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include<iostream> | |
#include<queue> | |
#include<climits> | |
#define initial 0 | |
#define waiting 1 | |
#define visited 2 | |
#define NIL -1 | |
using namespace std; | |
int adj[10][10]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include<stdio.h> | |
#include<stdlib.h> | |
#include<limits.h> | |
struct node{ | |
int data; | |
struct node *left; | |
struct node *right; | |
}; | |
struct node *newnode(int x) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include<iostream> | |
#include<cstdlib> | |
using namespace std; | |
struct node{ | |
int data; | |
struct node *left; | |
struct node *right; | |
}; |
NewerOlder