Please help me do this in F#
Please check out the first question I posted.
1.2.4 Problem 4 (20 pts)
1. A tree is perfect if all the leaves of the tree are at the same depth.
Define a function perfect: Tree<'a> -> bool that returns true if the tree supplied is perfect and false otherwise.
2. A tree is degenerate if all the nodes are arranged in a single path. Equivalently, a tree is degenerate if all nodes have at least one leaf child. Define a function degenerate: Tree<'a> -> bool that returns true if and only if the tree supplied is degenerate and false otherwise.
[ ]: let rec perfect t = // write your solution here
Test your function:
[ ]: perfect Leaf // true
[ ]: perfect (Node(Leaf,1,Leaf)) // true
[ ]: perfect (Node(Node(Leaf,2,Leaf),1,Leaf)) // false
[ ]: perfect (Node(Node(Leaf,2,Leaf),1,Node(Leaf,3,Leaf))) // true
[ ]: perfect (Node(Node(Node(Leaf,4,Leaf),2,Node(Leaf,3,Leaf)),1,Leaf)) // false
[ ]: perfect (Node(Node(Node(Leaf,4,Leaf),2,Leaf),1,Node(Node(Leaf,6,Leaf),5,Node(Leaf,7,Leaf)))) // false
[ ]: perfect (Node(Node(Node(Leaf,4,Leaf),2,Node(Leaf,3,Leaf)),1,Node(Node(Leaf,6,Leaf),5,Node(Leaf,7,Leaf)))) // true
[ ]: let rec degenerate t = // write your solution here
Test your function:
[ ]: degenerate Leaf // true
[ ]: degenerate (Node(Leaf,1,Leaf)) // true
[ ]: degenerate (Node(Node(Leaf,2,Leaf),1,Leaf)) // true