+1  A: 

Depends on what you want to do with it. List<LinkedListTree> might work in general case. If you need to represent disjoint sets (like Kruskal's MST algorithm) you might want to look at another data structure.

Mehrdad Afshari
+1  A: 

Best data Structure is a tree (as you mentioned, a forest since there are 2 here) However, S-expressions can easily represent trees - and S-expressions can represent lists of lists, which are equivalent to trees.

You can just adopt conventions for trees in list form, such as the first element is the current node, and the following elements are the children. Using this convention the first tree would be represented as:

(a1 (a1 (a11 (a111 a112 a113) a112) a12 a13))

The second by

(a2 (a21 a211)(a22 a221)(a23 (a231 a2311)(a232 a2321)))

And you could also adopt the convention that the top level is a forst, so you would just represent the forest consisting of the 2 lists above as a list of the 2 trees.

In case you didn't guess, a former Lisp programmer here :)

Larry Watanabe