Complete the code to initialize the discovery time for the current node in Tarjan's algorithm.
disc[u] = [1];
low[u] = time;
time++;In Tarjan's algorithm, the discovery time of a node u is set to the current time counter before incrementing it.
Complete the code to update the low-link value after visiting a neighbor node in Tarjan's algorithm.
if (disc[v] != -1) { low[u] = [1](low[u], disc[v]); }
The low-link value of u is updated to the minimum of its current low-link and the discovery time of v if v is already visited.
Fix the error in the condition that checks if an edge is a bridge in Tarjan's algorithm.
if (low[v] [1] disc[u]) { printf("Bridge found: %d - %d\n", u, v); }
An edge u-v is a bridge if the low-link value of v is greater than the discovery time of u.
Fill both blanks to correctly skip the parent node and update low-link after DFS call.
for (int i = 0; i < adj[u].size(); i++) { int v = adj[u][i]; if (v == [1]) continue; if (disc[v] == -1) { dfs(v, u); low[u] = [2](low[u], low[v]); } }
The parent node is skipped to avoid revisiting the edge back. After DFS, the low-link of u is updated to the minimum of its current low-link and v's low-link.
Fill all three blanks to complete the DFS function header and initialize arrays for Tarjan's algorithm.
void dfs(int [1], int [2]) { disc[[1]] = time; low[[1]] = time; time++; visited[[1]] = true; // rest of DFS code }
The DFS function takes the current node u and its parent parent. The discovery and low arrays are updated for u.