Graph Theory37 sections · 1633 units
Open in Course

Common Mistakes

(What goes wrong)

Incrementing timer after setting tout[v]. You should only increment after tin[v], not after tout[v]. Using tout[v] values that exceed nn.

All values should be bounded by nn since you only increment the timer nn times (once per node). Querying range [tin[v], tout[v]) but forgetting that only entry positions hold values.

Another common mistake: forgetting to handle the root's tout value. The root's tout should cover the entire array since its subtree is the full tree.