Efficient solution for the *same fringe* problem
The fringe of a binary tree is the sequence composed by its leaves, from
left to right. The same fringe problem [Hewitt & Patterson, 1970]
consists of determining whether two binary trees have the same fringe.
For example, the first two trees below have the same fringe, but the
last two do not: