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

How can i start to write this code with this data structure?
Example;

tree1 tree2
  3
/ \
5 6
/ \
7 4
       13
/ \
3 12
/ \ / \
5 6 9 6
/ \ / \
7 4 11 7
/ / \
2 3 4



Be a better friend, newshound, and know-it-all with Yahoo! Mobile. Try it now.