[Haskell-cafe] pls help about subtree

cetin tozkoparan cetintozkoparan at yahoo.com
Mon Apr 28 17:28:56 EDT 2008


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.  http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20080428/13574aa8/attachment.htm


More information about the Haskell-Cafe mailing list