Question: this is using haskell For Problems 3 and 4, use the following binary tree definition modified from lecture: It takes two type arguments, so nodes
this is using haskell
For Problems 3 and 4, use the following binary tree definition modified from lecture: It takes two type arguments, so nodes and leafs can contain different types of values. data Tree a b - Leaf b Node a (Tree a b) (Tree a b) deriving (Read, show, Eq) (6 points) Write a isFull :: Tree a b -> Bool function that tests for a full tree (every node has two leafs or two trees; a tree that's just a leaf is also full). Note: 2 of the 6 points are for using just pattern matching to check for a leaf or a node (no defining isNode or is Leaf functions to figure out what the argument looks like). For Problems 3 and 4, use the following binary tree definition modified from lecture: It takes two type arguments, so nodes and leafs can contain different types of values. data Tree a b - Leaf b Node a (Tree a b) (Tree a b) deriving (Read, show, Eq) (6 points) Write a isFull :: Tree a b -> Bool function that tests for a full tree (every node has two leafs or two trees; a tree that's just a leaf is also full). Note: 2 of the 6 points are for using just pattern matching to check for a leaf or a node (no defining isNode or is Leaf functions to figure out what the argument looks like)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
