Closed ranisnehal closed 3 years ago
Hi 😄, @ranisnehal Thanks for creating issue at AlgoTree, do read and follow the Code of Conduct and the Contribution Guidelines while contributing. Refer to PR's which has been merged earlier in AlgoTree Click Here Like, How many File they have changed?, Which type of files need to be change? and many more.
Hi 😄, thanks for creating issue at AlgoTree, do read and follow the Code of Conduct and the Contribution Guidelines while contributing.
/ Here is the solution of the program in c++/
using namespace std;
class solution{ public:
bool solve(int src , vector<int> &vis, vector<int> &order,vector<int> adj[]){
vis[src]= 1;
order[src]= 1;
for(auto x:adj[src])
{
if(!vis[x])
{
bool conf = solve(x,vis,order,adj);
if(conf == true)
return true;
}
else if(order[x])
return true;
}
order[src] = 0;
return false;
}
bool iscyclic(int v,vector
TIME COMPLEXITY:- O(V)
I have fix the issue #2056 in c++.
DETECT A CYCLE IN A DIRECTED GRAPH
We will be given a directed graph ,we have to check whether the graphs contains a cycle or not . our function should return true if the graph is containing at least one cycle else it will return false.
LANGUAGE:- IN C++
PLEASE ASSIGN THIS ISSUE TO ME.
THANK YOU: SNEHAL RANI