What is a Topological Sort used for?

What is a Topological Sort used for?

Approach: Describe scheduling or dependency resolution.

It is used for tasks that have dependencies, such as job scheduling, resolving symbol dependencies in linkers, and instruction scheduling in compilers.

Follow-up: What happens if the graph has a cycle?

Key concepts: scheduling, dependencies, compilation order.