

PostOrder Traversal (Not Using Recersive) - soasme
http://www.soasme.com/2014/05/15/post-order-traversal/

======
bediger4000
Suppose I have a binary tree, created by Combinatory Logic S, K and I
primitives. The S-primitive doesn't actually duplicate anything, it just
increases a reference count. So my binary tree is actually a Directed Acylic
Graph of a sort. See
[http://stratigery.com/cl/#INTERPRETER](http://stratigery.com/cl/#INTERPRETER)

I'll be examining these algorithms closely, but does an algorithm exist to
traverse the DAG so created as if it were a binary tree? I want to be able to
count the leaf nodes of the tree, without the traversal getting hung up in the
situation where an interior node's children are both the same node instance,
with a reference count of 2.

