Tree traversal in elixir, pre-order, in-order, post-order What am I doing wrong?

A common approach is to use either an atom that represents the empty tree, eg. nil or :empty, or to just use a empty map (%{}).

2 Likes

Usually what I see is either a [] for an empty/nil value and a [something] for a something value, it’s unambiguous and fast in all cases. :slight_smile:

2 Likes