Which Course First? Topological Sort

Plan an order for a student's courses where every prerequisite comes first, fast even for a huge catalog, and spot the loop of prerequisites that makes any order impossible: why alphabetical order, sorting by prerequisite count and rescanning the catalog all fall short, and the method that fixes them, a topological sort.

Updated

Cheat sheet: Which Course First? Topological Sort
Category
Data Structures
Level
Freelancer
Tags
Cycle, data structures, Directed Acyclic Graph (data-structures), Directed Graph, Topological Sort