mardi 28 avril 2020

if condition is being executed even after inside condition function with parameter returns false

bool isCycle(vector <int> adj[],int v)
{
    vector <bool> visited(v, false);
    for (int u = 0;u < v;u++)
    {
        if (visited[u] == false)
        {
           if(bfs(u, adj, visited,v));
                return true;
        }
    }
    return false;
}

even after function inside if condition returned false. Why is it executing the if condition ???

if(bfs(u, adj, visited,v));
       return true;

Aucun commentaire:

Enregistrer un commentaire