C++ | Kruskal's | Easy to Understand with comments
```\nclass Solution {\npublic:\n    int findPar(int x, vector &parent)\n    {\n        while(x != parent[x])\n            x = parent[x];\n        return x;\n   
```\nclass Solution {\npublic:\n    int findPar(int x, vector<int> &parent)\n    {\n        while(x != parent[x])\n            x = parent[x];\n        return x;\n    }\n    void unionn(int x, int y, vector<int> &parent, vector<int> &rank)\n    {\n        x = findPar(x,parent);\n        y = findPar(y, parent);\n        if(rank[x] < rank[y])\n            parent[x] = y;\n        else if(rank[x] > rank[y])\n            parent[y] = x;\n        else\n        {\n            parent[y] = x;\n            rank[x]++;\n        }\n    }\n    int MST(int &n, vector<vector<int>> &edges, vector<int> &include, vector<int> &exclude)//O(E)\n    {\n        int cost = 0;\n        vector<int> rank(n,0);\n        vector<int> parent(n);\n        for(int i=0; i<n; i++)\n            parent[i] = i;\n\n//if my must include edge is not null then I will join them and add their cost if they do not have same component\n        if(include.size() != 0)\n        {\n            if(findPar(include[0],parent) != findPar(include[1],parent))\n            {\n                unionn(include[0], include[1], parent, rank);\n                cost += include[2];\n            }\n        }\n        for(auto edge: edges)//O(E) as union find operation constant only for loop\n        {\n//if curr edge is not equal to must exclude vertex we will check further and do simple kruskal\'s method\n            if(edge != exclude)\n            {\n                if(findPar(edge[0],parent) != findPar(edge[1],parent))\n                {\n                    unionn(edge[0],edge[1],parent,rank);\n                    cost += edge[2];\n                }\n            }\n        }\n        //now if kruskal was not possbile by excluding any node, means all nodes can\'t be connected together then in that case we will return INF \n        \n        for(int i=0; i<n; i++)\n        {\n            //means when all are not connected so return\n            if(findPar(i,parent) != findPar(0,parent))\n                return 1e5;\n        }\n        return cost;\n    }\n    static bool compare(vector<int> &a, vector<int> &b)\n    {\n        return a[2] < b[2];///sorting according to weigths in asc order\n    }\n    vector<vector<int>> findCriticalAndPseudoCriticalEdges(int n, \n    vector<vector<int>>& edges) \n    {\n        vector<int> criticalEdge;\n        vector<int> pseudoEdge;\n        map<vector<int>,int> edgeIndex;\n//map of edge and index as I want the indexes for the ans\n        \n        for(int i=0; i<edges.size(); i++)\n        {\n            edgeIndex[edges[i]] = i;\n        }\n        sort(edges.begin(), edges.end(), compare);//O(ElogE);\n        \n        vector<int> temp;\n//empty vector which I am going to pass when I want the must include include edge null and same for must exclude edge\n        \n        int minCost = MST(n, edges, temp, temp);//min cost considering all edges\n\n        for(auto edge: edges)//O(E^2)\n        {\n//I will check if by excluding and including current edge in the loop what effect it has on cost\n            int exclude_cost = MST(n, edges,temp, edge);//(n,edges,include,exclude)\n            if(exclude_cost > minCost)\n                criticalEdge.push_back(edgeIndex[edge]);//means critical edge as by excluding it our cost gets increased\n            else\n            {\n                int include_cost = MST(n,edges,edge,temp);\n                if(include_cost == minCost)//means pseudoEdge as by excluding and including it doesn\'t effect our minCost \n                    pseudoEdge.push_back(edgeIndex[edge]);\n            }\n        }\n        return {criticalEdge, pseudoEdge};//our final ans\n        \n        //hope you all understood it well :)\n    }\n};
['C']