Search⌘ K

Challenge 3: Topological Sorting of a Graph

Explore how to apply recursion to solve the topological sorting problem in directed acyclic graphs. This lesson teaches you to determine a valid order for task execution based on dependencies between tasks represented as graph vertices. Gain practical experience implementing the algorithm to return a linear ordering of nodes that respects directed edges in the graph.

Problem Statement

Imagine you have been given the task to schedule some tasks. The tasks are represented as vertices of the graph, and if a task uu must be completed before a task vv can be started, then there is an edge from ...