Tag Archives: recursion

Tail-recursive tree traversal example in Scala

This is a demonstration of a tree-traversal algorithm to calculate the size of a binary tree, in Scala. The two implementations are recursive, as one should try to do in functional programming, but the first implementation is not tail-recursive, and the second is.

Continue reading