Question: In Prolog, define a predicate mergesort(In,Out) that makes a sorted version of a list In of numbers and unifies that result with Out. Your predicate
In Prolog, define a predicate mergesort(In,Out) that makes a sorted version of a list In of numbers and unifies that result with Out. Your predicate should use a merge-sort algorithm. SWI-Prolog has a predefined predicated called sort, and another called msort, that implement variations of merge sort. Don't use those, but choose another name for yours.
DON'T USE PREDEFINED PREDICATES SORT OR MSORT
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
