C++: Find Bridges Using Tarjan's Algorithm
c++\nclass Solution {\n    vector<vector<int>> adj;\n    vector<bool> visited;\n    vector<int> low;\n    vector<int> order;\n    int count = 0;\n    \n    vect
```c++\nclass Solution {\n    vector<vector<int>> adj;\n    vector<bool> visited;\n    vector<int> low;\n    vector<int> order;\n    int count = 0;\n    \n    vector<vector<int>> bridges;\n    \n    void dfs(int node, int parent = -1) {\n        visited[node] = true;\n        low[node] = order[node] = ++count;\n        \n        for(int neighbour: adj[node]) {\n            if(!visited[neighbour]) {\n                \n                dfs(neighbour, node);\n                \n                low[node] = min(low[node], low[neighbour]);\n                \n                if(order[node] < low[neighbour]) {\n                    // Bridge\n                    bridges.push_back({node, neighbour});\n                }\n            } else if(neighbour != parent) {\n                low[node] = min(low[node], order[neighbour]);\n            }\n        }\n    }\n    \npublic:\n    vector<vector<int>> criticalConnections(int n, vector<vector<int>>& connections) {\n        adj.resize(n);\n        visited.resize(n, false);\n        low.resize(n, 0);\n        order.resize(n, 0);\n        \n        for(vector<int> edge: connections) {\n            adj[edge[0]].push_back(edge[1]);\n            adj[edge[1]].push_back(edge[0]);\n        }\n        \n        \n        for(int node = 0; node < n; ++node) {\n            if(!visited[node]) {\n                dfs(node);\n            }\n        }\n        return bridges;\n    }\n};\n```
['Depth-First Search', 'C']