2008/4/28 cetin tozkoparan <[EMAIL PROTECTED]>: > Assume a tree is a subtree of the other if all elements of the first tree > is included in the second with the exact structure; all parent-child > relations are preserved with their order. > > data Tree = Empty | Leaf Int | Node (Int,Tree,Tree) > subtree:: Tree -> Tree -> Bool >
Let me also point out that since you store an Int at each Node, there is no need for the explicit Leaf constructor; for example, Leaf 5 can be represented as Node 5 Empty Empty. Simplifying your data structure in this way will make writing code for it much simpler and more elegant. -Brent
_______________________________________________ Haskell-Cafe mailing list [email protected] http://www.haskell.org/mailman/listinfo/haskell-cafe
