C++ solution using Kruskals Algo
Complexity\n- Time complexity:\nO(m^2 alpha(n))\n\n# Code\n\nclass Solution {\nprivate:\n    int parent[101];\n    int rank[101];\n\n    void dsu(int n){\n     
# Complexity\n- Time complexity:\n$$O(m^2 alpha(n))$$\n\n# Code\n```\nclass Solution {\nprivate:\n    int parent[101];\n    int rank[101];\n\n    void dsu(int n){\n        for(int i=0;i<n;i++){\n            parent[i] = i;\n            rank[i] = 0;\n        }\n    }\n\n    int findParent(int n){\n        if(parent[n] == n)\n            return n;\n        \n        return parent[n] = findParent(parent[n]);\n    }\n\n    void unionDSU(int a, int b){\n        int para = findParent(a);\n        int parb = findParent(b);\n        if(para == parb)\n            return;;\n        \n        int ranka = rank[para];\n        int rankb = rank[parb];\n        \n        if(ranka > rankb)\n            parent[parb] = para;\n        else if(rankb > ranka)\n            parent[para] = parb;\n        else{\n            parent[para] = parb;\n            rank[parb]+=1;\n        }\n    }\n\npublic:\n    int makeMST(vector<vector<int>>&edges, int index, int n){\n        dsu(n);\n        int res = 0;\n\n        for(int i=0;i<edges.size();i++){\n            if(i == index)\n                continue;\n            \n            int para = findParent(edges[i][0]);\n            int parb = findParent(edges[i][1]);\n            if(para!=parb){\n                res+=edges[i][2];\n                unionDSU(edges[i][0], edges[i][1]);\n            }\n        }\n        return res;\n    }\n\n    int makeMSTwithIndex(vector<vector<int>>&edges, int index, int n){\n        dsu(n);\n        int res = edges[index][2];\n\n        unionDSU(edges[index][0], edges[index][1]);\n\n        for(int i=0;i<edges.size();i++){\n            int para = findParent(edges[i][0]);\n            int parb = findParent(edges[i][1]);\n            if(para!=parb){\n                res+=edges[i][2];\n                unionDSU(edges[i][0], edges[i][1]);\n            }\n        }\n        return res;\n    }\n\n    void dfs(vector<pair<int, int>>adj[], int node, vector<int>&vis){\n        vis[node] = 1;\n        for(auto it: adj[node]){\n            if(vis[it.first] == 0)\n                dfs(adj, it.first, vis);\n        }\n    }\n\n    vector<vector<int>>criticalnpseudoCritical(vector<vector<int>>&edges, int n){\n        int minWtMST = makeMST(edges, -1, n);\n\n        vector<vector<int>>res;\n        vector<int>critical;\n        vector<int>pseudoCritical;\n\n        for(int i=0;i<edges.size();i++){\n            vector<pair<int, int>>adj[n];\n            for(int j=0;j<edges.size();j++){\n                if(i == j) continue;\n                int a = edges[j][0];\n                int b = edges[j][1];\n                int wt = edges[j][2];\n\n                adj[a].push_back({b, wt});\n                adj[b].push_back({a, wt});\n            }\n            int compCount = 0;\n            vector<int>vis(n, 0);\n\n            for(int j=0;j<n;j++){\n                if(!vis[j]){\n                    ++compCount;\n                    dfs(adj, j, vis);\n                }\n            }\n\n            if(compCount > 1){\n                critical.push_back(edges[i][3]);\n                continue;\n            }\n            \n            int val = makeMST(edges, i, n);\n            int val2 = makeMSTwithIndex(edges, i, n);\n\n            if(val > minWtMST){\n                critical.push_back(edges[i][3]);\n            }\n            if(val == val2){\n                pseudoCritical.push_back(edges[i][3]);\n            }\n        }\n\n        res.push_back(critical);\n        res.push_back(pseudoCritical);\n\n        return res;\n\n    }\n\n    static bool comp(vector<int>a, vector<int>b){\n        return a[2] < b[2];\n    }\n\n    vector<vector<int>> findCriticalAndPseudoCriticalEdges(int n, vector<vector<int>>& edges) {\n        for(int i=0;i<edges.size();i++){\n            edges[i].push_back(i);\n        }\n        sort(edges.begin(), edges.end(), comp);\n        return criticalnpseudoCritical(edges, n);\n    }\n};\n```
['C++']