- DFS, Graph Coloring, Greedy, n-ary-tree, Recursion, Searching, Tree

Minimum time required to color all edges of a Tree

  #include using namespace std;  int ans = 0;  vector edges[100000];  void Add_edge(int u, int v){    edges[u].push_back(v);    edges[v].push_back(u);}  void minTimeToColor(int node, int parent,                    int arrival_time){            int current_time = 0;      for (auto x : edges[node]) {                  if (x != parent) {                                      ++current_time;                                      if (current_time == arrival_time)                ++current_time;                          ans = max(ans, current_time);                                      minTimeToColor(x, node, current_time);        }    }}  int main(){      pair A[] = { { 1, 2 },                            { 2, 3 },                            { 3, 4 } };      for (auto i : A) {          Add_edge(i.first, i.second);    }          minTimeToColor(1, -1, 0);          cout