AppliedAIPrep logoAppliedAI/Prep
💻 Coding & Engineering Craft
Core

Topological Sort and DAGs

A topological sort orders the nodes of a directed acyclic graph so that every edge points forward, which is exactly what dependency resolution needs. Kahn's algorithm peels off zero-indegree nodes while DFS post-order reverses the finish times, and both detect cycles for free when no valid order exists. Applied-AI interviews probe it because build systems, data pipelines, and task schedulers are dependency graphs, and the course-schedule question is its canonical disguise.

a free account unlocks the core curriculum tier · no card
RELATED CONCEPTS
PRACTICE THIS IN REAL QUESTIONS
COMPANIES THAT ASSUME THIS
NEXT IN CODING & ENGINEERING CRAFTUnion-Find (Disjoint Set Union)