Back to Dashboard

Pro pattern

Upgrade to Pro to access this pattern and all 22 patterns.

Upgrade
PATTERN

Advanced Graphs

Master topological sorting (Kahn's BFS and DFS post-order) for dependency ordering and cycle detection in directed graphs, plus Union-Find (Disjoint Set Union) with path compression and union by rank for connected components, cycle detection in undirected graphs, and element grouping.

Learn Advanced GraphsExplanation, templates & reference

Course Schedule

medium

Number of Provinces

medium

Accounts Merge

medium

Course Schedule II

hard

Alien Dictionary

hard

Redundant Connection

hard