C++ solution finding bridges
\nThe problem simply asks us to find the bridges in the graph.\nLets take an example of the following graph:-\n\n   0------1 \n   |       \\ \n   |        \\\n 
```\nThe problem simply asks us to find the bridges in the graph.\nLets take an example of the following graph:-\n\n   0------1 \n   |       \\ \n   |        \\\n   |         \\\n   |          \\\n   5----3-------2\n        |\n        |\n        4\n\nA bridge is simply an edge in an undirected connected graph reoving which disconnects the graph.\nTo find all the bridges in the graph we perform a dfs to visit each node.\nWhile we visit each node we assign two values to it id number and lowlink number.\n\nId number - Denotes the time at which the node is visited.\nLowlink number - Denotes whether there is other early node(based on id number) that can be visited by that node.\n\n\n\n(id=1,\n lowlink=1)\n   |       \n   0------1  \n   |       \\ \n   |        \\\n   |         \\\n   |          \\\n   5----3-------2\n        |\n        |\n        4\n\n(id=1,\n lowlink=1)\n   |       \n   0------1  <----(id=2,lowlink=2)\n   |       \\ \n   |        \\\n   |         \\\n   |          \\\n   5----3-------2\n        |\n        |\n        4\n\n (id=1,\n lowlink=1)\n   |       \n   0------1  <----(id=2,lowlink=2)\n   |       \\ \n   |        \\\n   |         \\\n   |          \\\n   5----3-------2 <----(id=3,lowlink=3)\n        |\n        |\n        4\n\n (id=1,\n lowlink=1)\n   |       \n   0------1  <----(id=2,lowlink=2)\n   |       \\ \n   |        \\\n   |         \\\n   |(id=4,ll=4)\\\n   5----3-------2 <----(id=3,lowlink=3)\n        |\n        |\n        4\n\n\n   (id=1,\n lowlink=1)\n   |       \n   0------1  <----(id=2,lowlink=2)\n   |       \\ \n   |        \\\n   |         \\\n   |(id=4,ll=4)\\\n   5----3-------2 <----(id=3,lowlink=3)\n        |\n        |\n        4\n        |\n   (id=5,lowlink=5)  \n\nSince there are no unvisited nodes to node 4 we have to check 2 things while cosidering 3(parent) and 4(node):-\n\n1. Compare the lowlink values of 3 and 4 and assign the minimum value to 3(Since the low value of 3 and 4 minimum is 3 we dont do anything).\n\nWhy did we do this?\nWe needed to compare the lowlink values of both nodes to update the information of nodes 3s connectivity to the earliest node possible.\n\n2. We compare the lowlink value of 4 and id value of 3.This will decide whether this edge is a bridge or not.\nAs the id value of 3 is lesser than the lowlink value of 4 we can safely say that node 4 has no connections with nodes which where made at earlier time.\nThus 3-4 is a bridge.\n\nNote that 1 and 2 are if else cases if low[node]<=low[neighbor] then perform 1\nelse perform 2\n\n                             (id=1,\n                              lowlink=1)\n                                 |       \n                                 0------1  <----(id=2,lowlink=2)\n                                 |       \\ \n                                 |        \\\n                                 |         \\\n                                 |(id=4,ll=4)\\\n          (id=6,lowlink=6)--->   5----3-------2 <----(id=3,lowlink=3)\n                                      |\n                                      |\n                                      4\n                                      |\n                            (id=5,lowlink=5)  \n\nThen perform the same operations with the other nodes.\n\n\n\nclass Solution {\npublic:\n    vector<vector<int>> ans;\n    vector<vector<int>> graph;\n    vector<int> id;\n    vector<int> lowlink;\n    vector<bool> vis;\n    int time=0;\n    void dfs(int node,int parent)\n    {\n        id[node]=lowlink[node]=time++;\n        vis[node]=true;\n        for(int &x:graph[node])\n        {\n            if(parent==x)continue;\n            if(vis[x]==false)\n            {\n                dfs(x,node);\n                lowlink[node]=min(lowlink[node],lowlink[x]);\n                if(id[node]<lowlink[x])\n                    ans.push_back({node,x});\n            }\n            else \n                lowlink[node]=min(lowlink[node],id[x]);\n        }\n    }\n    vector<vector<int>> criticalConnections(int n, vector<vector<int>>& connections) {\n        graph.resize(n);\n        vis.resize(n,false);\n        lowlink.resize(n,0);\n        id.resize(n,0);\n        for(auto &x:connections)\n        {\n            graph[x[0]].push_back(x[1]);\n            graph[x[1]].push_back(x[0]);\n        }\n        for(int i=0;i<n;i++)\n        {\n            if(vis[i]==false)\n                dfs(i,i);\n        }\n        return ans;\n    }\n};\n```
['C', 'C++']