Skip to main content

Posts

Featured

CODE FOR FINDING THE BRIDGE IN THE CONNECTED GRAPH

  #include< bits/stdc++.h > using namespace std; void find_bridge(vector<vector<int>>&graph,vector<int>&vis,vector<int>&time,int &curr_time,vector<pair<int,int>>&edges,int node,int parent){     vis[node]=1;     time[node]=curr_time; curr_time++;     for(int i=0;i<graph[node].size();i++){         if(vis[graph[node][i]]==1)continue;         find_bridge(graph,vis,time,curr_time,edges,graph[node][i],node);     }     if(parent==-1)return;     int min=time[node];     for(int i=0;i<graph[node].size();i++){         if(graph[node][i]==parent)continue;         int a =time[graph[node][i]];         if(min>a)min=a;     }     if(min>time[parent])edges.push_back(make_pair(parent,node));     time[node]=min;     return;...

Latest Posts

SEGMENT TREE AND ITS IMPLEMENTATION

INTUITION BEHIND THE TOWER OF HANOI AND THE RECURSION II

INTUITION BEHIND THE TOWER OF HANOI AND THE RECURSION I

SITUATIONS WHERE GREEDY APPROACH FAILS.....

Code for DFS Traversing of the graph in C++....

COMPLETE STEP BY STEP MATHEMATICS FOR COMPETITIVE PROGRAMMING