write haskell code for the following
Exercise 3. Binary trees 16+5 = 21 points The following data type defines binary trees holding integers, which can be a leaf with a value or an internal node with a value and two children. data Tree - Node Tree Tree | Leaf Int deriving (Eq,Show) Given this data type, the following function computes the left most integer stored in the tree CSCE 550, Spring 2020. Homework ! leftmost :: Tree -> Int leftmost (Leaf 1) - i leftmost (Node 1 ) - leftmost Complete the following questions. (a) For each function below, give its type and implementat rightmost - undefined -- Compute the right most integer in the tree maxInt - undefined Get the maximum integer from the input binary tree sum Ints - undefined Calculate sum of ali integers stored in a tree balanced - undefined - A tree is balanced 1. for each node, the number eaves in the left and right subtree differ by at most one, with leaves themselves being trivially balanced of 3 (1) Define netton balance that ivert y listo Valinta balanced tre (Note: You may want the elite exiliary function have that plit i list into two halves whoe length differ hy at 1.) Exercise 3. Binary trees 16+5 = 21 points The following data type defines binary trees holding integers, which can be a leaf with a value or an internal node with a value and two children. data Tree - Node Tree Tree | Leaf Int deriving (Eq,Show) Given this data type, the following function computes the left most integer stored in the tree CSCE 550, Spring 2020. Homework ! leftmost :: Tree -> Int leftmost (Leaf 1) - i leftmost (Node 1 ) - leftmost Complete the following questions. (a) For each function below, give its type and implementat rightmost - undefined -- Compute the right most integer in the tree maxInt - undefined Get the maximum integer from the input binary tree sum Ints - undefined Calculate sum of ali integers stored in a tree balanced - undefined - A tree is balanced 1. for each node, the number eaves in the left and right subtree differ by at most one, with leaves themselves being trivially balanced of 3 (1) Define netton balance that ivert y listo Valinta balanced tre (Note: You may want the elite exiliary function have that plit i list into two halves whoe length differ hy at 1.)