next up previous
Next: Example: Professor Bumstead gets Up: CSE 2320: Algorithms and Previous: Topological Sort

Pseudocode

TopologicalSort(G) $\;\;\;\;\;$ $\;\;\;\;\;$ $\;\;\;\;\;$; $\Theta(V+E)$
$\;\;\;\;\;$DFS(G), as each vertex finishes, insert it on the front of
$\;\;\;\;\;$ $\;\;\;\;\;$ $\;\;\;\;\;$the linked list
$\;\;\;\;\;$return linked list of vertices



Copyright © 1998 The University of Texas at Arlington