Question: Question 6 a) The merge-sort algorithm for sorting a list is based on dividing the list into smaller lists, then sorting each smaller list and

Question 6 a) The merge-sort algorithm for sorting a list is based on dividing the list into smaller lists, then sorting each smaller list and finally merging these sorted smaller lists into one resulting list Accordingly, to sort list L Divide L into two lists Ll and L2 of approximately equal length Sort L1 and L2 (using merge-sort) giving S1 and S2 respectively Merge SI and S2 giving the sorted list R (10) Write a Prolog implementation of merge-sort (b) Write a procedure satisfy(P, L) that .eceives a binary predicate symbol ? and returns the list L of all terms x for which P(X,Y) succeeds for some y (4)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
