Disjoint Set(Level-2)
1) Detect a cycle in graph
#include <bits/stdc++.h>
using namespace std;
struct Edge {
int src, dest;
};
struct Graph {
int V, E;
vector<Edge> edges;
};
// Find the root parent of a node (with path compression)
int find(vector<int>& pa...
farazalam2017.hashnode.dev3 min read