D. Using unwrap() on parent[u] without checking if it is Some
Solution
Step 1: Check unwrap usage on parent[u]
parent[u] may be None for root node, unwrap() causes panic if None.
Step 2: Identify safe handling
Code should check if parent[u] is Some before unwrap or handle root separately.
Final Answer:
Using unwrap() on parent[u] without checking if it is Some -> Option D
Quick Check:
Unsafe unwrap on Option causes runtime panic [OK]
Hint: Check Option unwrap safety for root node [OK]
Common Mistakes:
Ignoring root node parent None case
Assuming unwrap() is always safe
Missing visited marking (actually present here)
5. Given a graph with multiple disconnected components, how should the articulation points algorithm be adapted in Rust to find all articulation points?
hard
A. Run DFS from every unvisited vertex to cover all components
B. Run DFS only from vertex 0 assuming graph is connected
C. Run BFS instead of DFS for articulation points
D. Ignore disconnected components as they have no articulation points
Solution
Step 1: Understand disconnected graph scenario
Articulation points can exist in any component, so all must be checked.
Step 2: Adapt algorithm to run DFS on all components
Run DFS from every unvisited vertex to cover all disconnected parts.
Final Answer:
Run DFS from every unvisited vertex to cover all components -> Option A
Quick Check:
Multiple DFS runs cover all components [OK]
Hint: Run DFS on all unvisited nodes for full coverage [OK]
Common Mistakes:
Assuming graph is always connected
Using BFS which doesn't track articulation points easily
Ignoring disconnected components
Recommended
Ready to prove it?
Pass the test and this pattern moves unknownstrongwhile earning +1 Grip toward your certificate.