Depth-First Tree Traversal in F#

We looked at breath-first tree tra­ver­sal ear­li­er today, now let’s take a look at depth-first tree tra­ver­sal as well.

Here, we loop through the tree start­ing with the root, yield the val­ue for each of the nodes before recur­sive­ly tra­vers­ing down all the left branch first and then the right branch.


Try it Yourself