Question: Using F# only, thank you! Part 3 Write the following binary search tree functions for a binary search tree of integers. (This will essentially be

Using F# only, thank you!Using F# only, thank you! Part 3 Write the following binary search

Part 3 Write the following binary search tree functions for a binary search tree of integers. (This will essentially be a tree set, i.e., a set data structure implemented using a tree.) Use the following type definition for a BST (copy this into your solution): // Tree definition for problem 3 type BST = Empty | TreeNode of int * BST * BST 1. insert value tree o Inserts the value into the tree and returns the resulting tree. The resulting tree does NOT need to be balanced. If the value already exists in the tree, return the tree without inserting the value. 2. contains value tree o Returns true if the value is in the tree or false if it is not. 3. count func tree o The parameter func is a Boolean function that takes a single parameter and returns true or false. The function tests the value of each node with func and returns the number of nodes that evaluate to true. 4. evenCount tree o Returns the number of nodes that contain even integers. O REQUIREMENT: This function may not call any other function by name, except for the count function. However, you may use lambda functions (which do not have a name). Part 3 Write the following binary search tree functions for a binary search tree of integers. (This will essentially be a tree set, i.e., a set data structure implemented using a tree.) Use the following type definition for a BST (copy this into your solution): // Tree definition for problem 3 type BST = Empty | TreeNode of int * BST * BST 1. insert value tree o Inserts the value into the tree and returns the resulting tree. The resulting tree does NOT need to be balanced. If the value already exists in the tree, return the tree without inserting the value. 2. contains value tree o Returns true if the value is in the tree or false if it is not. 3. count func tree o The parameter func is a Boolean function that takes a single parameter and returns true or false. The function tests the value of each node with func and returns the number of nodes that evaluate to true. 4. evenCount tree o Returns the number of nodes that contain even integers. O REQUIREMENT: This function may not call any other function by name, except for the count function. However, you may use lambda functions (which do not have a name)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!