Question: Complete this function in Ocaml (* Sort list l via mergesort cmp is a function that compares two elements of list l. When cmp returns

Complete this function in Ocaml

(* Sort list l via mergesort

cmp is a function that compares two elements of list l. When cmp

returns true, its first argument comes first in the sorted lest.

When cmp returns false, its second argument comes first in the

sorted list. *)

let rec mergesort (cmp : 'a->'a->bool) (l:'a list) : 'a list =

(* TODO, replace [] *)

[]

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!