Write a merge function that merges two lists xs and ys


Problem

Write a merge function that merges two lists, xs and ys:

If either list has length 0, just return xs ++ ys. Otherwise,

If the first value in xs is less than or equal to the first value in ys, use cons to prepend the first value in xs to the result of a recursive call one the rest of xs and all of ys.

If the first value in xs is less than the first value in ys, prepend the first value in ys to the result of a recursive call on xs and the rest of ys.

Note that the data type of the items in the list must be an Ord, so the type signature will be:

merge :: Ord a => [a] -> [a] -> [a]

Request for Solution File

Ask an Expert for Answer!!
Computer Engineering: Write a merge function that merges two lists xs and ys
Reference No:- TGS03277003

Expected delivery within 24 Hours