Question: I need to write these two functions in haskell for searching a BST tree: successor :: Ord a => a -> Tree a -> Maybe

I need to write these two functions in haskell for searching a BST tree:

successor :: Ord a => a -> Tree a -> Maybe a

--Given a value (a) , search a tree to find the successor node (next highest value)

closest :: Int -> Tree Int -> Int

--Given an int, search a tree and find the node with the losest value to the given int (can be larger or smaller)

--Given

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!