Topological sort
medium 20 minA topological sort lists the nodes of a directed graph so that every edge u → v has u before v: a valid order for tasks with prerequisites.
A topological sort lists the nodes of a directed graph so that every edge u → v has u before v: a valid order for tasks with prerequisites.