Circular Trees

Examples where trees
(the instances of tree values, not the data type definition)
are self-dependent, recursive, or circular.

N-Queens

e.g. N=5

Q

Q

Q

Q

Q

1

3

5

2

4

"The well known n-queens problem is to place n queens
on an n×n chess board so that no two queens threaten
each other. Each queen must be on a separate row,
column and diagonal and this property is an invariant
that must be maintained as partial solutions are extended.
The fastest imperative solutions [Rohl 1983] are based on
permutation generators. A board is represented by
the permutation of rows that the queens on the columns occupy.
This representation automatically ensures the separate row and column
parts of the invariant. Here we observe that a partial solution
abcde can be extended to a partial solution abcdeX if and
only if bcdeX is also a partial solution and a and X are
on separate diagonals and rows. By using shadows*, X need
only be tested against a's diagonals as the results of
the other diagonal tests against other queens are already encoded in the
shadow tree and do not need to be repeated.[...]" -
(Allison 1993)[*]
The shadow of the partial solution abcde
is bcde which is also a partial solution and
must be in the tree (and closer to the root),
if abcde is in the tree.