In this post biziclop inserted the pseudocode for the non-recursive Depth-First Search algorithm.
If we want to use the recursive DFS algorithm is used to check the nodes for a propriety, we can exploit two variants: pre-order (when a node is checked before his children) and post-order (when the children are checked before the node), plus a third variant (in-order: left subtree, then node, then right subtree) for binary tree only.
Since I am interested into having all three variants if possible, I tried to modify biziclop 's pseudocode in order to obtain all three variants of the DFS algorithm. Problem being, I got stuck on the fact that the node is added to the stack (and thus checked) before its children. Any idea?