Question: Please help in writing these functions in OCaml functional programming language asap!!!! Write a function called that takes two arguments: an and a returns if

Please help in writing these functions in OCaml functional programming language asap!!!!
Write a function called that takes two arguments: an and a returns if the is present in the tree, or otherwise. Note: The levels of the trees don't matter for this function. 2. and Write the two rotation functions described above; call them and_. Note that not all trees can be changed by a skew or a split operation; if a tree is not able to be skewed or split, just return the tree unchanged. Note also that these functions are not recursive; they only act on the top of the tree. Both of these functions can be written in a few lines of code each. You will want to use OCaml's pattern-matching capabilities on constructors. Remember that pattern-matches on recursive datatypes can be more than one level. For instance, a pattern match on a Node constructor doesn't have to be just: If and/or are also s, you can put them right into the pattern-match. For instance: INode(lvl,v,Node(lvl2,v2,ll,lr),Node(lvl3,v3,rl,rr)) If the subtrees are not Node s, the pattern won't match. Of course, you don't have to do this sort of thing, but it can shorten the code you need to write. When you convert the diagrams given above to the rotation code, make sure to notice which parts of the trees change and which parts don't. This can also shorten the code. You might find this helper function to be useful: (* Level of an AA tree. ) let level = function | Leaf 0 | Node ( lvl,_,_-_) lvl
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
