(Due Date: Wednesday 10th, March)
Question 1:
Write a function sublist which receives two list and return true if the first list is a sublist of the second, or false otherwise. (In lists the order is important, thus for example [2,4,5] is a sublist of [3,7,2,4,5,9] but not [3,7,4,2,5,9]).
Question 2:
Write a function subtree which receives two binary trees and return true if the first tree is a subtree of the second, or false otherwise.
(In trees the structure is important, thus a tree could be a subtree in any place).
For this function you have to use the following datatype: - datatype tree = Empty | Leaf of int | Node of int*tree*tree; Example: - val tree1 = Node(3,Leaf(5), Node(6,Leaf(7),Leaf(4)) ); 3 / \ 5 6 / \ 7 4 - val tree2 = Node(13,Node(3,Leaf(5), Node(6,Node (7, Leaf (2), Empty), Node(4,Leaf(3),Leaf(4)) ) ) , Node(12,Leaf(9), Node(6,Leaf(11),Leaf(7)) ) ); 13 / \ 3 12 / \ / \ 5 6 9 6 / \ / \ 7 4 11 7 / / \ 2 3 4 - subtree(tree1,tree2); > true