Depth-first digraph algorithms without recursion

After having taught the design of algorithms for more than ten years I still find that recursive algorithms are much too difficult for most computer science students. There seem to be two problems: the students are unable to grasp the essence of an algorithm in a recursive setting, and they rarely have any knowledge of the mechanisms underlying recursive calls. In view of the above it was thought useful to translate a number of recursive algorithms into nonrecursive form for classroom use. Tarjan's depth-first search algorithms for digraphs (4,5) were selected because they are sufficiently important to require their study in some computer science course or other. The translation consists of making the depth-first search tree of the digraph explicit, and letting tree traversals take over the role of recursion. The nonrecursive algorithm for topological ordering of an acyclic digraph will be our example here. This algorithm is used to preprocess a scheduling network before it is subjected to critical path analysis.