What does flattening list of items into tree means
If I had a list of lists, “flatten” would be the operation that returns a list of all the leaf elements in order, i.e., something that changes:
[[a, b, c], [d, e, f], [g, h i]]
Into
[a, b, c, d, e, f, g, h, i]
For trees, flatting is generating a list of all leaves in natural traversal order (NB: since only leaves are in the result, it doesn’t matter whether you think of this as pre-, in- or post-order traversal.
[Read More]