AIInterviewTraining logoAIInterview/Training
💻 Coding & Engineering Craft
Core

Topological Sort and DAGs

A topological sort arranges the nodes of a directed acyclic graph so that every edge points forward, which is exactly what dependency resolution requires. Kahn's algorithm peels off zero-indegree nodes while DFS post-order reverses the finish times, and both catch cycles for free when no valid order exists. Applied-AI interviews test it because build systems, data pipelines, and task schedulers are dependency graphs, and the course-schedule question is its usual 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)